home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / td120.zip / TDOODLE.ASM < prev    next >
Assembly Source File  |  1986-01-23  |  77KB  |  2,788 lines

  1. comment * WordStar Tab Ruler
  2. L-------!-------!---------------!----!----!----!----!----!----!----!---------------------------R
  3. 12-30-85
  4. *
  5. cseg segment para public 'code'
  6. assume cs:cseg,ds:cseg,es:cseg,ss:cseg
  7.  
  8.  
  9. len_picture=1688
  10.  
  11.         org     0h
  12. Zero:                           ;ret to DOS
  13.         org     100h
  14. start:  jmp     init            ;goto initialization routine
  15.  
  16. buffer          db 256 dup(?)
  17.  
  18.  
  19.  
  20. handle          dw ?
  21. char            db ?
  22. filespec_ptr    dw ?
  23. filespec_buffer1 db 256 dup(?) 
  24. filespec_buffer2 db 256 dup(?)
  25. space_count     db ?
  26. write           db ?
  27. save_attribs    db ?
  28. screen_no       db ?
  29. filename1       db 65 dup(?)
  30. filename2       db 65 dup(?)
  31.  
  32. screen_page     db ?
  33. attrib          db ?
  34. mode            db ?
  35. say_color_flag  db 0
  36. cursor          dw ?
  37.  
  38. max_line        db ?
  39. cur_line        db ?
  40. max_col         db ?
  41. cur_col         db ?
  42. create          db ?
  43. rotate          db ?
  44. space_size      db ?
  45. ins_del_flag    db ?
  46.  
  47. cursor_size     dw ?
  48. screen_seg      dw ?
  49. screen_buffer   dw ?
  50.  
  51. paste_size      dw ?            ; y/x size of paste_buffer
  52. last_x          db ?
  53. last_y          db ?
  54. block_cursor    label word
  55.  cursor_x       db ?
  56.  cursor_y       db ?
  57. quad            db ?
  58. wrap_flag       db ?
  59.  
  60. cmd_cmd        db ?
  61.  
  62. esc=27
  63. yes=255
  64. no=0
  65.  
  66. dos     macro   function
  67.         mov     ah,function
  68.         int     21h
  69.         endm
  70.  
  71. getkey  macro 
  72.         call    get_keystroke
  73.         endm
  74.  
  75. wait_for_key macro
  76.         local   wfk_1
  77. wfk_1:  getkey
  78.         jz      wfk_1
  79.         endm
  80.  
  81. get_keystroke:
  82.         mov     ah,1
  83.         int     16h
  84.         jz      GK_ret
  85.         pushf
  86.         mov     ah,0
  87.         int     16h
  88.         popf    
  89. GK_ret: ret
  90.  
  91. jump    macro table,item
  92.         mov     bx,offset table
  93.         mov     al,item
  94.         call    table_jump
  95.         endm
  96. ;
  97. search  macro   table,item
  98.         mov     bx,offset table
  99.         mov     ax,item
  100.         call    table_search
  101.         endm
  102. ;
  103. table_jump:
  104.         cmp     cs:[bx],al         ;too big an offset?
  105.         jc      TJ_end
  106.         dec     bx
  107.         mov     ah,0
  108.         add     ax,ax           ;prep offset
  109.         add     bx,ax           ;get actual addr of routine
  110.         jmp     word ptr cs:[bx]     ;go to routine
  111. TJ_end: ret
  112. ;
  113. table_search:
  114.         push    bx
  115.         push    cx              ;search table @ BX for AL
  116.         push    dx
  117.         push    di
  118.         or      al,al           ;2-byter
  119.         jz      TS_10           ;yes, don't clear top
  120.         mov     ah,0            ;otherwise...
  121.         call    capit_al
  122. TS_10:  mov     cl,[bx]         ;get len of $ to search
  123.         mov     ch,0
  124.         mov     di,bx
  125. TS_5:   inc     di              ;skip length
  126.         mov     dx,[di]         ;get table entry
  127.         or      dl,dl           ;test for 2-byter
  128.         jnz     TS_2            ;no
  129.         inc     di
  130.         jmp short TS_3
  131. TS_2:   mov     dh,0            ;clear top byte for cmp
  132. TS_3:   cmp     ax,dx           ;are they the same?
  133.         je      TS_4            ;go if they are
  134.         loop    TS_5            ;else go to end of table
  135.         jmp short TS_1          ;done but not found
  136. TS_4:   mov     ch,[bx]         ;get len of table again
  137.         sub     ch,cl           ;get offset into table
  138.         mov     ah,ch           ;get offset into ah
  139.         inc     ah              ;make go from 1
  140.         xor     bx,bx           ;set flags
  141. TS_1:   pop     di
  142.         pop     dx
  143.         pop     cx
  144.         pop     bx
  145.         ret
  146. ;
  147. capit_al:
  148.         cmp     al,'a'
  149.         jc      CA_1
  150.         cmp     al,'z'+1
  151.         jnc     CA_1
  152.         sub     al,32
  153. CA_1:   ret
  154.  
  155. retf    macro   pop_value
  156.  ifb <pop_value>
  157.         db      0cbH            ;far ret w/no [pop-value]
  158.  else
  159.         db      0caH            ;far ret w/pop-value
  160.         dw      pop_value
  161.  endif
  162.         endm
  163. ;
  164.  
  165. ceol db esc,'[K$'
  166.  
  167. print_cs_space:
  168.         mov     ah,9
  169.         int     21h
  170.         mov     dl,32
  171.         mov     ah,2
  172.         int     21h
  173.         ret
  174.  
  175. print_cs:
  176.         mov     ah,9
  177.         int     21h
  178.         mov     dx,offset ceol
  179.         mov     ah,9
  180.         int     21h
  181.         ret
  182.  
  183.  
  184. save_screen:
  185.         mov     si,0
  186.         mov     di,[screen_buffer]
  187.         mov     ax,screen_seg
  188.         mov     ds,ax
  189.         mov     cx,1760
  190.         rep     movsw
  191.         mov     ax,es
  192.         mov     ds,ax
  193.         ret
  194.  
  195. MU_undo:
  196. restore_screen:
  197.         pushf
  198.         push    ax
  199.         push    cx
  200.         push    si
  201.         push    di
  202.         mov     ax,screen_seg
  203.         mov     es,ax
  204.         mov     si,[screen_buffer]
  205.         mov     di,0
  206.         mov     cx,1760
  207.         rep     movsw
  208.         mov     ax,ds
  209.         mov     es,ax
  210.         pop     di
  211.         pop     si
  212.         pop     cx
  213.         pop     ax
  214.         popf
  215.         ret
  216.  
  217.  
  218. memory_error db 'Memory allocation error (not enough, or bad allocation blocks)',13,10,10
  219.  
  220. ansi_test db esc,'[H',8,8,8,'   ',8,8,8,'$'
  221. ansi_error db 13,10,'tDoodle 1.11',13,10,'Please add the following line to your '
  222.            db 'CONFIG.SYS file:',13,10,10
  223.            db 'DEVICE=ANSI.SYS',13,10,10,'$'
  224.  
  225. break_handler:
  226.         iret
  227.  
  228. No_parm:
  229.         call    cls
  230.         mov     cx,len_picture
  231.         mov     dx,offset screen_buffer_1
  232.         mov     bx,0            ;CON
  233.         mov     ah,40h          ;write to file
  234.         int     21h
  235. np_1:   getkey
  236.         jnz     np_1
  237. np_2:   getkey
  238.         jz      np_2
  239.  
  240.         call    cls
  241.         jmp     editor
  242.  
  243. bad_dos_version db 'tDoodle 1.00: Incorrect DOS Version.$'
  244.  
  245. ;************* Start *********************
  246. init:   mov     ah,30h
  247.         int     21h             ;get DOS ver #
  248.         cmp     al,2
  249.         jae     init_9
  250.         mov     dx,offset bad_dos_version
  251.         mov     ah,9
  252.         int     21h
  253.         jmp     zero
  254.  
  255. init_9: mov     bh,0
  256.         mov     ah,3
  257.         int     10h             ;get curpos
  258.         push    dx
  259.         mov     dh,24
  260.         mov     dl,0
  261.         mov     ah,2
  262.         int     10h             ;set curpos
  263.         mov     dx,offset ansi_test
  264.         dos     9
  265.         mov     ah,3
  266.         int     10h
  267.         or      dx,dx
  268.         pop     dx
  269.         pushf
  270.         mov     ah,2
  271.         int     10h             ;restore cursor
  272.         popf
  273.         jz      ansi_installed
  274.         mov     dx,offset ansi_error
  275.         dos     9
  276.         jmp     zero            ;terminate (no ANSI.SYS)
  277.  
  278. parm_error_so:
  279.         jmp     parm_error
  280.  
  281. ansi_installed:
  282.         mov     bx,offset end_of_code
  283.         mov     cl,4
  284.         shr     bx,cl           ;turn byte count into para's
  285.         inc     bx
  286.         mov     ah,4Ah
  287.         int     21h
  288.         jnc     init_10
  289.         mov     dx,offset Memory_error
  290.         call    print_cs
  291.         jmp     zero
  292.  
  293. no_parm_so: 
  294.         jmp no_parm
  295.  
  296. init_10:
  297.         mov     ah,25h          ;get ^Break addr
  298.         mov     al,23h          ;^BREAK int #
  299.         mov     dx,offset Break_handler
  300.         int     21h
  301.         
  302.         mov     ah,3
  303.         int     10h             ;get cursor size
  304.         mov     cursor_size,cx
  305.         call    fix_cursor_block
  306.  
  307.         mov     screen_buffer,offset screen_buffer_1
  308.         mov     al,0            ;set display_ctrls filename(s) to ""
  309.         mov     byte ptr filename1,al
  310.         mov     byte ptr filename2,al
  311.         mov     filespec_ptr,offset filespec_buffer1
  312.         mov     filespec_buffer1+1,al
  313.         mov     filespec_buffer2+1,al
  314.         mov     al,64
  315.         mov     filespec_buffer1,al
  316.         mov     filespec_buffer2,al
  317.         mov     screen_no,1
  318.  
  319.         mov     di,filespec_ptr
  320.         inc     di              ;skip input len
  321.  
  322.         mov     si,80h          ;parameter addr
  323.         lodsb                   ;get len of command$
  324.         mov     bl,al
  325.         mov     bh,0
  326.         or      bl,bh           ;is len(parm)=0?
  327.         jz      No_Parm_so
  328.         mov     byte ptr [si+bx],0   ;terminate ASCIIZ
  329.  
  330. init_loop_1:
  331.         lodsb                   ;get char of $
  332.         or      al,al           ;EOS?
  333.         jz      Parm_error_so
  334.         cmp     al,13           ;EOS?
  335.         jz      Parm_error_so
  336.         cmp     al,9            ;nothing?
  337.         jz      init_loop_1
  338.         cmp     al,32           ;space?
  339.         jz      init_loop_1
  340.         dec     si
  341.  
  342.         push    si
  343.         mov     cl,0
  344.         inc     di
  345. init_1: lodsb
  346.         stosb
  347.         inc     cl
  348.         cmp     al,0            ;EOS?
  349.         jne     init_1
  350.         dec     cl
  351.         mov     byte ptr [filespec_buffer1+1],cl
  352.         pop     si
  353.  
  354.         mov     dx,si
  355.         mov     al,2            ;open for r/w
  356.         mov     ah,3Dh
  357.         int     21h             ;open file
  358.         jnc     Load_File_so
  359.         cmp     al,2
  360.         jnz     File_open_error
  361.         mov     dx,si
  362.         mov     ah,3Ch
  363.         mov     cx,0
  364.         int     21h
  365.         jc      File_open_error
  366. Load_file_so:
  367.         jmp     Load_file
  368.  
  369. Parm_error_message db 'Bad parameter line',13,10,'$'
  370. File_open_error_message db 'Couldn',27h,'t open file',13,10,'$'
  371. Load_error_message db 'Had trouble loading file.',13,10,'$'
  372.  
  373. Parm_error:
  374.         mov     dx,offset Parm_error_message
  375.         call    print_cs
  376.         jmp     ret_to_dos
  377. File_open_error:
  378.         mov     dx,offset File_open_error_message
  379.         call    print_cs
  380.         jmp     ret_to_dos
  381. Load_error:
  382.         mov     byte ptr [di-1],13
  383.         mov     bx,handle
  384.         mov     ah,3Eh
  385.         int     21h
  386.         mov     dx,offset Load_error_message
  387.         call    print_cs
  388. Ret_to_DOS_2:
  389. Ret_to_DOS:
  390.         jmp     Zero
  391.  
  392. cls_string db esc,'[=2h',esc,'[?7h',esc,'[0m',esc,'[2J','$'
  393.  
  394. cls:    mov     dx,offset cls_string
  395.         call    print_cs
  396.         mov     attrib,7
  397.         call    fix_cursor_block
  398.         ret
  399.  
  400. Load_File:
  401.         mov     handle,ax
  402.  
  403.         call    cls
  404. Load_loop:
  405.         mov     bx,handle
  406.         mov     ah,3Fh
  407.         mov     cx,1
  408.         mov     dx,offset buffer
  409.         int     21h
  410.         jc      Load_Error
  411.         or      ax,ax
  412.         jz      Load_Ended
  413.  
  414.         mov     dl,byte ptr [buffer]
  415.         cmp     dl,26           ;^Z terminating?
  416.         jz      Load_Ended
  417.  
  418.         mov     ah,2
  419.         int     21h
  420.         jmp     Load_loop
  421.  
  422. Load_Ended:
  423.         mov     bx,handle
  424.         mov     ah,3Eh
  425.         int     21h             ;close file
  426.  
  427.         mov     cx,0            ;home cursor
  428.         call    set_cur_pos
  429.         call    move_filename   ;setup filename on ctrl-line
  430.         jmp     Editor
  431.  
  432. text_table db 17
  433.         db 8     ;bksp
  434.         db 13    ;RET
  435.         db 0,71  ;HOME
  436.         db 0,72  ;up
  437.         db 0,73  ;PgUp
  438.         db 0,75  ;lt
  439.         db 0,77  ;rt
  440.         db 0,79  ;END
  441.         db 0,80  ;dn
  442.         db 0,81  ;PgDn
  443.         db 27    ;ESC
  444.         db 0,82  ;INS
  445.         db 0,83  ;DEL
  446.         db 9     ;TAB
  447.         db 0,115 ;^lt
  448.         db 0,116 ;^rt
  449.         db 0,119 ;^HOME
  450.  
  451.  
  452.  
  453. text_jmp_table db 17
  454.         dw offset key_bksp
  455.         dw offset key_cr
  456.         dw offset key_home
  457.         dw offset key_up
  458.         dw offset key_pgup
  459.         dw offset key_lt
  460.         dw offset key_rt
  461.         dw offset key_end
  462.         dw offset key_dn
  463.         dw offset key_pgdn
  464.         dw offset key_esc
  465.         dw offset key_ins
  466.         dw offset key_del
  467.         dw offset key_tab
  468.         dw offset key_ctrl_lt
  469.         dw offset key_ctrl_rt
  470.         dw offset key_ctrl_home
  471.  
  472. cmd_key db 10, esc,'GRCSLQWFU'
  473.  
  474. cmd_table db 10
  475.         dw offset cmd_esc       ;toggle to/from text/cmd
  476.         dw offset cmd_G         ;replace IBM graphics
  477.         dw offset cmd_R         ;replace (not implemented)
  478.         dw offset cmd_C         ;set Colors
  479.         dw offset cmd_S         ;Save file
  480.         dw offset cmd_L         ;Load file
  481.         dw offset cmd_Q         ;Quit tDoodle
  482.         dw offset cmd_W         ;Wipe out screen (cls)
  483.         dw offset cmd_F         ;Flip between screens
  484.         dw offset cmd_U         ;Undo (edit: F9)
  485.  
  486. box_key_table db 22, '12345678QWEASDZXC-_\| '
  487. box_table_list label word
  488.         dw offset box_table_1
  489.         dw offset box_table_2
  490.         dw offset box_table_3
  491.         dw offset box_table_4
  492.  
  493. box_table_1 db 176,177,178,219,220,223,221,222
  494.             db 218,194,191,195,197,180,192,193,217,196,196,179,179,32
  495. box_table_2 db 176,177,178,219,220,223,221,222
  496.             db 201,203,187,204,206,185,200,202,188,205,205,186,186,32
  497. box_table_3 db 176,177,178,219,220,223,221,222
  498.             db 213,209,184,198,216,181,212,207,190,205,205,179,179,32
  499. box_table_4 db 176,177,178,219,220,223,221,222
  500.             db 214,210,183,199,215,182,211,208,189,196,196,186,186,32
  501.  
  502. fn_table db 10
  503.         db 0,59                 ;F1: rotate box modes
  504.         db 0,60                 ;F2: set csr attr to cur attr
  505.         db 0,61                 ;F3: reverse screen attribs
  506.         db 0,62                 ;F4: rotate paint/text/both 
  507.         db 0,63                 ;F5: show colors
  508.         db 0,64                 ;F6: Flip from one screen to the other
  509.         db 0,65                 ;F7: Pickup
  510.         db 0,66                 ;F8: PutDown
  511.         db 0,67                 ;F9: Undo
  512.         db 0,68                 ;F0: ASCII table
  513.  
  514. mode_update_table db 10
  515.         dw offset MU_boxes
  516.         dw offset MU_attrib
  517.         dw offset MU_reverse
  518.         dw offset MU_put_mode
  519.         dw offset MU_show_colors
  520.         dw offset MU_flip
  521.         dw offset MU_Pickup
  522.         dw offset MU_PutDown
  523.         dw offset MU_Undo
  524.         dw offset MU_ascii
  525.  
  526. key_ctrl_home:
  527.         call    get_cur
  528.         mov     cl,39
  529.         jmp     set_cur_pos
  530. key_ctrl_rt:
  531.         call    get_cur
  532.         mov     cl,78
  533.         jmp     set_cur_pos
  534. key_ctrl_lt:
  535.         call    get_cur
  536.         mov     cl,0
  537.         jmp     set_cur_pos
  538. key_lt: call    get_cur
  539.         cmp     cl,0
  540.         jz      KL_1
  541.         dec     cl
  542. SCP:    jmp     Set_cur_pos
  543. KL_1:   cmp     wrap_flag,255
  544.         jne     scp
  545.         mov     cl,78
  546. Key_up_2:
  547.         or      ch,ch
  548.         jz      Set_cur_pos
  549.         dec     ch
  550.         jmp     Set_Cur_pos
  551. Key_cr:
  552.         call    get_cur
  553.         cmp     ch,21
  554.         jz      Set_Cur_pos
  555.         inc     ch
  556.         mov     cl,0
  557.         jmp     Set_Cur_pos
  558. Key_rt: call    get_cur
  559.         cmp     cl,78
  560.         jne     KR_1
  561.         cmp     wrap_flag,255
  562.         jne     set_cur_pos
  563.         jmp     Key_cr
  564. KR_1:   inc     cl
  565. Set_cur_pos:
  566.         mov     ah,2
  567.         mov     bh,screen_page
  568.         mov     dx,cx
  569.         int     10h
  570.         cmp     say_color_flag,0
  571.         jz      SCP_ret
  572.         call    say_color
  573. SCP_ret:
  574.         ret
  575. Key_up: call    get_cur
  576.         jmp     Key_up_2
  577. Key_dn: call    get_cur
  578.         cmp     ch,21
  579.         jz      Set_cur_pos
  580.         inc     ch
  581.         jmp     Set_cur_pos
  582. Key_home:
  583.         mov     cx,0
  584.         jmp     Set_cur_pos
  585. Key_PgUp:
  586.         call    Key_up
  587.         call    key_rt
  588.         ret
  589. Key_PgDn:
  590.         call    Key_dn
  591.         call    key_rt
  592.         ret
  593. Key_End:
  594.         mov     cx,21*256
  595.         jmp     Set_cur_pos
  596. key_bksp:
  597.         call    key_lt
  598.         mov     al,32           ;print space
  599.         mov     ah,attrib       ;in current attrib
  600.         call    alt_modes
  601.         mov     bh,0
  602.         mov     cx,1
  603.         mov     ah,9
  604.         int     10h
  605.         ret
  606. get_cur:
  607.         mov     ah,3
  608.         mov     bh,screen_page
  609.         int     10h
  610.         mov     cx,dx
  611.         ret
  612. key_esc:
  613.         clc
  614.         call    save_cur
  615.         pop     ax
  616.         ret
  617.  
  618. key_ins:
  619.         mov     bh,screen_page
  620.         mov     ah,3
  621.         int     10h
  622.         mov     cursor,dx
  623.         mov     al,attrib
  624.         push    ax
  625.  
  626.         mov     ins_del_flag,255
  627.         push    dx              ;save it for later
  628.         mov     dl,78           ;last col
  629.  
  630. KI_1:   dec     dl
  631.         mov     ah,2            ;set curpos
  632.         int     10h
  633.         mov     ah,8
  634.         int     10h             ;read c/a
  635.         mov     attrib,ah
  636.         push    ax
  637.  
  638.         inc     dl
  639.         mov     ah,2
  640.         int     10h
  641.         pop     ax
  642.         push    dx
  643.         call    alt_modes
  644.         pop     dx
  645.         mov     cx,1
  646.         mov     ah,9
  647.         int     10h             ;write c/a
  648.  
  649.         dec     dl
  650.         pop     cx
  651.         cmp     dl,cl
  652.         push    cx
  653.         jne     KI_1
  654.         pop     cx
  655.         mov     ah,2
  656.         int     10h             ;reset cursor
  657.  
  658.         pop     ax
  659.         mov     attrib,al
  660.         mov     al,32
  661.         call    alt_modes
  662.         mov     cx,1
  663.         mov     ah,9
  664.         int     10h
  665.  
  666.         mov     ins_del_flag,0
  667.         ret
  668.  
  669. key_del:
  670.         mov     bh,screen_page
  671.         mov     ah,3
  672.         int     10h             ;get curpos
  673.         mov     cursor,dx
  674.         mov     al,attrib
  675.         push    ax
  676.  
  677.         mov     ins_del_flag,255
  678.  
  679. kd_1:   inc     dl              ;next col over
  680.         mov     ah,2
  681.         int     10h
  682.         mov     ah,8
  683.         int     10h             ;get c/a
  684.         mov     attrib,ah
  685.         push    ax
  686.  
  687.         dec     dl
  688.         mov     ah,2
  689.         int     10h
  690.         pop     ax
  691.         push    dx
  692.         call    alt_modes
  693.         pop     dx
  694.         mov     cx,1
  695.         mov     ah,9
  696.         int     10h
  697.  
  698.         inc     dl
  699.         cmp     dl,78
  700.         jne     kd_1
  701.         mov     ah,2
  702.         int     10h
  703.  
  704.         pop     ax
  705.         mov     attrib,al
  706.         mov     al,32
  707.         call    alt_modes
  708.         mov     cx,1
  709.         mov     ah,9
  710.         int     10h
  711.  
  712.         mov     dx,cursor
  713.         mov     ah,2
  714.         int     10h
  715.         mov     ins_del_flag,0
  716.         ret
  717.  
  718. key_tab:
  719.         mov     bh,screen_page
  720.         mov     ah,3
  721.         int     10h             ;get curpos
  722.         mov     cl,3
  723.         sar     dl,cl
  724.         inc     dl
  725.         sal     dl,cl
  726.         and     dl,255-7
  727.         cmp     dl,78
  728.         jbe     kt_cont
  729.         mov     dl,78
  730.         cmp     dh,22
  731.         je      kt_cont
  732.         inc     dh
  733.         mov     dl,0
  734.  
  735. kt_cont:
  736.         mov     ah,2
  737.         int     10h
  738.         ret
  739.  
  740. fix_cursor_block:
  741.         mov     ah,15
  742.         int     10h             ;get screen mode
  743.         mov     screen_page,bh
  744.         mov     cx,12           
  745.         mov     dx,0B000h       ;mono seg
  746.         mov     say_color_flag,255
  747.         cmp     al,7            ;monochrome
  748.         jz      set_cursor_block
  749.         mov     cl,7
  750.         mov     dx,0B800h       ;cga seg
  751.         mov     say_color_flag,0
  752. set_cursor_block:
  753.         mov     screen_seg,dx
  754.         mov     ah,1
  755.         int     10h             ;set new cursor 
  756.         ret
  757.  
  758. restore_cursor_block:
  759.         mov     cx,cursor_size
  760.         mov     ah,1
  761.         int     10h
  762.         ret
  763.  
  764.  
  765. Editor: mov     attrib,7        ;default, white on black
  766.         mov     mode,0          ;text mode
  767.         call    cmd_f
  768.         call    cls
  769.         call    cmd_f
  770.  
  771. Editor_loop:
  772.         mov     wrap_flag,255
  773.         mov     save_attribs,yes     ;use ANSI's for menus
  774.         call    display_ctrls
  775.         call    mode_text       ;go update screen
  776.         call    mode_cmd
  777.         jnc     Editor_loop
  778.         call    cls
  779.         call    restore_cursor_block
  780.         jmp     Ret_to_DOS_2
  781.  
  782. mode_text:
  783.         getkey  
  784.         jz      mode_text
  785.         push    ax
  786.         search  text_table,ax
  787.         jnz     MT_text
  788.         pop     dx
  789.         jump    text_jmp_table,ah
  790.         jmp     mode_text
  791. MT_text:
  792.         pop     ax              ;get back key
  793.         push    ax              ;and save it back
  794.         search  fn_table,ax
  795.         je      mode_update
  796.         pop     ax
  797.         or      al,al
  798.         jz      mode_text       ;bad keystroke
  799.         cmp     al,32
  800.         jb      mode_text
  801.         call    alt_modes
  802.         mov     cx,1
  803.         mov     ah,9
  804.         int     10h
  805.         call    key_rt
  806.         jmp     mode_text
  807.  
  808. mode_update:
  809.         pop     dx              ;clear stack
  810.         jump    mode_update_table,ah
  811.         mov     wrap_flag,255
  812.         jmp     mode_text
  813.  
  814. MU_boxes:
  815.         mov     ah,mode
  816.         test    ah,128
  817.         jz      F1_start
  818.         mov     al,ah
  819.         and     al,252
  820.         inc     ah
  821.         and     ah,3
  822.         or      ah,ah
  823.         jz      F1_end
  824.         or      ah,al
  825.         mov     mode,ah
  826.         call    display_ctrls
  827.         ret
  828. F1_end: and     al,127
  829.         mov     mode,al
  830.         call    display_ctrls
  831.         ret
  832. F1_start:
  833.         or      ah,128
  834.         and     ah,252
  835.         mov     mode,ah
  836.         call    display_ctrls
  837.         ret
  838.  
  839. MU_attrib:
  840.         mov     ah,8
  841.         mov     bh,screen_page
  842.         int     10h
  843.         mov     attrib,ah
  844.         call    display_ctrls
  845.         ret
  846.  
  847. MU_reverse:
  848.         mov     ah,attrib
  849.         mov     al,ah
  850.         mov     cl,4
  851.         ror     ah,cl
  852.         and     ah,255-(128+8)  ;clear int/blnk bits
  853.         and     al,128+8
  854.         or      ah,al           ;move old blnk/int into attribs
  855.         mov     attrib,ah
  856.         call    display_ctrls
  857.         ret
  858.  
  859. MU_put_mode:
  860.         mov     ah,mode
  861.         mov     cl,5
  862.         ror     ah,cl
  863.         and     ah,3
  864.         test    ah,1            ;not "both"?
  865.         jnz     MU_pm_1         ;go if not "both"
  866.         mov     ah,1
  867. MU_pm_3:
  868.         mov     al,mode
  869.         and     al,255-96       ;clear out current mode
  870.         rol     ah,cl
  871.         or      al,ah
  872.         mov     mode,al       ;set new one
  873.         call    display_ctrls
  874.         ret
  875. MU_pm_1:
  876.         xor     ah,2            ;set 0 to 1
  877.         test    ah,2            ;is it 0
  878.         jz      MU_pm_2
  879.         jmp     MU_pm_3
  880. MU_pm_2:
  881.         mov     ah,0
  882.         jmp     MU_pm_3
  883.  
  884.  
  885. mu_sc_setup db esc,'[24;1f$'
  886.  
  887. mu_sc_colors db 8
  888.         dw offset mu_black
  889.         dw offset mu_blue
  890.         dw offset mu_green
  891.         dw offset mu_cyan
  892.         dw offset mu_red
  893.         dw offset mu_magenta
  894.         dw offset mu_yellow
  895.         dw offset mu_white
  896.  
  897. mu_black        db 'Black$'
  898. mu_blue         db 'Blue$'
  899. mu_green        db 'Green$'
  900. mu_cyan         db 'Cyan$'
  901. mu_red          db 'Red$'
  902. mu_magenta      db 'Magenta$'
  903. mu_yellow       db 'Yellow$'
  904. mu_white        db 'White$'
  905.  
  906. mu_blinking     db 'Blinking$'
  907. mu_bright       db 'Bright$'
  908. mu_on           db 'on$'
  909. mu_comma        db 8,',$'
  910.  
  911. MU_show_colors:
  912.         xor     say_color_flag,255
  913.         cmp     say_color_flag,0
  914.         jne     say_color
  915.         ret
  916.  
  917. say_color:
  918.         push    ax
  919.         push    bx
  920.         push    cx
  921.         push    dx
  922.         push    si
  923.         push    di
  924.  
  925.         mov     bh,screen_page
  926.         mov     ah,8
  927.         int     10h             ;get c/a
  928.         push    ax
  929.  
  930.         mov     ah,3
  931.         int     10h             ;get curpos
  932.         mov     cursor,dx
  933.  
  934.         mov     dx,offset mu_sc_setup
  935.         call    print_cs
  936.  
  937.         pop     ax              ;get c/a
  938.         push    ax
  939.         test    ah,8            ;bright?
  940.         jz      MU_sc_1
  941.         mov     dx,offset mu_bright
  942.         call    print_cs_space
  943.         pop     ax 
  944.         push    ax
  945.         test    ah,128          ;blinking?
  946.         jz      mu_sc_1
  947.         mov     dx,offset mu_comma
  948.         call    print_cs_space
  949.         pop     ax
  950.         push    ax
  951. mu_sc_1:
  952.         test    ah,128          ;blinking?
  953.         jz      mu_sc_2
  954.         mov     dx,offset mu_blinking
  955.         call    print_cs_space
  956.         pop     ax
  957.         push    ax
  958. mu_sc_2:
  959.         and     ah,7            ;get foreground color
  960.         mov     al,ah
  961.         mov     ah,0
  962.         add     ax,ax
  963.         mov     bx,ax
  964.         inc     bx
  965.         mov     si,offset mu_sc_colors
  966.         mov     dx,[si+bx]
  967.         call    print_cs_space
  968.         mov     dx,offset mu_on
  969.         call    print_cs_space
  970.         pop     ax
  971.         mov     cl,4
  972.         ror     ah,cl
  973.         and     ah,7
  974.         mov     al,ah
  975.         mov     ah,0
  976.         add     ax,ax
  977.         mov     bx,ax
  978.         inc     bx
  979.         mov     dx,[si+bx]
  980.         call    print_cs
  981.  
  982.         mov     dx,cursor
  983.         mov     ah,2
  984.         mov     bh,screen_page
  985.         int     10h
  986.  
  987.         pop     di
  988.         pop     si
  989.         pop     dx
  990.         pop     cx
  991.         pop     bx
  992.         pop     ax
  993.         ret
  994.  
  995.  
  996. alt_modes:
  997.         test    mode,128        ;is graphic active?
  998.         jz      AM_paint        ;no, go check attr only
  999.         test    ins_del_flag,1  ;no box conv?
  1000.         jnz     AM_paint
  1001.         search  box_key_table,ax
  1002.         je      AM_1
  1003.         pop     ax              ;clear stack
  1004.         jmp     mode_text
  1005. AM_1:   mov     dl,mode
  1006.         mov     dh,0
  1007.         and     dl,3
  1008.         add     dx,dx
  1009.         mov     bx,offset box_table_list
  1010.         add     bx,dx
  1011.         mov     bx,cs:[bx]      ;get addr of xlat table
  1012.         dec     ah
  1013.         mov     al,ah
  1014.         mov     ah,0
  1015.         add     bx,ax
  1016.         mov     al,cs:[bx]      ;get xlated box part
  1017.  
  1018. AM_paint:                       ;t/a lockout? 
  1019.         push    ax
  1020.         test    mode,32
  1021.         jz      AM_normal
  1022.         mov     bh,screen_page
  1023.         mov     ah,8
  1024.         int     10h             ;get c/a
  1025.         test    mode,64         ;text only?
  1026.         jz      AM_attr         ;no, attr only.
  1027.         mov     bl,ah           ;set attr to what's under cur
  1028.         mov     bh,screen_page
  1029.         pop     ax              ;recover text
  1030.         ret
  1031.  
  1032. AM_attr:
  1033.         pop     dx              ;scrap old text
  1034.         mov     bh,screen_page
  1035.         mov     bl,attrib
  1036.         ret
  1037.  
  1038. AM_normal:
  1039.         pop     ax
  1040.         mov     bh,screen_page
  1041.         mov     bl,attrib
  1042.         ret
  1043.  
  1044. mup_inst db esc,'[24;1fUse ',24,' ',25,' ',26,' and ',27,' to move,',13,10
  1045.         db 'F7 to set other end of block, ESC to abort CUT.$'
  1046.  
  1047.  
  1048. mu_Pickup:
  1049.         call    save_screen
  1050.         call    save_cur
  1051.         mov     al,say_color_flag
  1052.         mov     ah,attrib
  1053.         push    ax
  1054.         mov     say_color_flag,0
  1055.         mov     wrap_flag,0
  1056.         mov     di,0700h
  1057.         mov     si,00FFh        ;setup for CLS2
  1058.         mov     dx,0            ;csrpos
  1059.         mov     bh,screen_page
  1060.         push    cursor
  1061.         call    cls2
  1062.         pop     cursor
  1063.  
  1064.         mov     dx,offset mup_inst
  1065.         call    print_cs
  1066.         call    restore_cur
  1067.         mov     dx,cursor
  1068.         mov     block_cursor,dx
  1069.         mov     last_x,dl
  1070.         mov     last_y,dh
  1071.         call    fix_block
  1072.  
  1073. mup_1:  getkey
  1074.         jz      mup_1
  1075.         cmp     ax,4100h        ;F7?
  1076.         je      mup_2
  1077.  
  1078.         search  text_table,ax
  1079.         jne     mup_1
  1080.         cmp     ah,2
  1081.         je      mup_1
  1082.         cmp     ah,3
  1083.         je      mup_1
  1084.         cmp     ah,8
  1085.         je      mup_1
  1086.         cmp     ah,12
  1087.         je      mup_1
  1088.         cmp     ah,13
  1089.         je      mup_1
  1090.         cmp     ah,11
  1091.         je      mup_esc
  1092.         cmp     ah,14
  1093.         jnc     mup_1
  1094.         jump    text_jmp_table,ah
  1095.         call    fix_block
  1096.         jmp     mup_1
  1097. mup_esc:
  1098.         pop     ax
  1099.         mov     say_color_flag,al
  1100.         mov     attrib,ah
  1101.         call    restore_screen
  1102.         call    display_ctrls
  1103.         call    restore_cur
  1104.         ret
  1105.  
  1106. mup_2:  mov     bh,screen_page
  1107.         mov     ah,3            ;read curpos
  1108.         int     10h
  1109.         mov     cx,block_cursor
  1110.         cmp     ch,dh           ;make DX hold bigger y/x
  1111.         jbe     mup_3
  1112.         xchg    ch,dh
  1113. mup_3:  cmp     cl,dl
  1114.         jbe     mup_4
  1115.         xchg    cl,dl
  1116.  
  1117. mup_4:  push    dx              ;save bigger values
  1118.         sub     dx,cx
  1119.         inc     dl
  1120.         inc     dh              ;make go from 1
  1121.         mov     paste_size,dx   ;set y/x of block size
  1122.         pop     dx
  1123.  
  1124.         call    restore_screen
  1125.         mov     di,offset paste_buffer
  1126.         xchg    cx,dx           ;move small curpos to cursor register
  1127.         
  1128. mup_6:  push    dx
  1129. mup_5:  mov     ah,2
  1130.         int     10h
  1131.         mov     ah,8
  1132.         int     10h
  1133.         stosw
  1134.  
  1135.         cmp     dl,cl
  1136.         je      mup_next_line
  1137.         inc     dl
  1138.         jmp     mup_5
  1139.  
  1140. mup_next_line:
  1141.         pop     dx
  1142.         cmp     dh,ch
  1143.         je      mup_end
  1144.         inc     dh
  1145.         jmp     mup_6
  1146.  
  1147. mup_end:
  1148.         jmp     mup_esc
  1149.  
  1150.  
  1151. fb_y_more:
  1152.         jmp     fb_y_more_routine
  1153.  
  1154. fix_block:
  1155.         mov     bh,screen_page
  1156.         mov     ah,3
  1157.         int     10h             ;get curpos
  1158.         cmp     dl,last_x
  1159.         jb      fb_x_less
  1160.         ja      fb_x_more
  1161.         call    fb_center
  1162. fb_1:   cmp     dh,last_y
  1163.         jb      fb_y_less
  1164.         ja      fb_y_more
  1165.         call    fb_center
  1166. fb_2:   mov     last_x,dl
  1167.         mov     last_y,dh
  1168.         mov     ah,2
  1169.         int     10h             ;reset curpos
  1170.         ret
  1171.  
  1172. fb_x_less:
  1173.         cmp     dl,cursor_x
  1174.         jb      fbxl_less
  1175.  
  1176.         mov     cl,last_x
  1177.         cmp     dl,cl
  1178.         push    dx
  1179.         mov     attrib,7
  1180.         mov     dh,last_y
  1181.         jbe     fbxl_1
  1182.         xchg    dl,cl
  1183. fbxl_1: inc     dl
  1184.         call    fb_v_line
  1185.         cmp     dl,cl
  1186.         jne     fbxl_1
  1187.         pop     dx
  1188.         jmp     fb_1
  1189.  
  1190. fbxl_less:
  1191.         mov     cl,last_x
  1192.         cmp     dl,cl
  1193.         push    dx
  1194.         mov     attrib,7*16
  1195.         jae     fbxl_2
  1196.         xchg    dl,cl
  1197. fbxl_2: call    fb_v_line
  1198.         cmp     dl,cl
  1199.         je      fbxl_3
  1200.         dec     dl
  1201.         jmp     fbxl_2
  1202. fbxl_3: pop     dx
  1203.         jmp     fb_1
  1204.  
  1205. fb_x_more:
  1206.         cmp     dl,cursor_x
  1207.         ja      fbxl_less
  1208.  
  1209.         mov     cl,last_x
  1210.         push    dx
  1211.         mov     attrib,7
  1212.         mov     dh,last_y
  1213.         cmp     dl,cl
  1214.         jbe     fbxm_1
  1215.         xchg    dl,cl
  1216. fbxm_1: call    fb_v_line
  1217.         inc     dl
  1218.         cmp     dl,cl
  1219.         jne     fbxm_1
  1220.         pop     dx
  1221.         jmp     fb_1
  1222.  
  1223. fb_y_less:
  1224.         mov     quad,0
  1225.         cmp     dh,cursor_y
  1226.         mov     quad,0
  1227.         jb      fbyl_less
  1228.         mov     quad,255
  1229. fbym_1: mov     ch,last_y
  1230.         cmp     dh,ch
  1231.         push    dx
  1232.         mov     attrib,7
  1233.         mov     dl,last_x
  1234.         jbe     fbyl_1
  1235.         xchg    dh,ch
  1236. fbyl_1: call    fbyl_fix_quad_3_4
  1237. fbyl_2: call    fb_h_line
  1238.         inc     dh
  1239.         cmp     dh,ch
  1240.         jne     fbyl_2
  1241.         pop     dx
  1242.         jmp     fb_2
  1243.  
  1244. fbyl_less:
  1245.         mov     ch,last_y
  1246.         cmp     dh,ch
  1247.         push    dx
  1248.         mov     attrib,7*16
  1249.         jae     fbyl_4
  1250.         xchg    dh,ch
  1251. fbyl_4: dec     ch
  1252.  
  1253. fbyl_3: call    fb_h_line
  1254.         dec     dh
  1255.         cmp     dh,ch
  1256.         jne     fbyl_3
  1257.         pop     dx
  1258.         jmp     fb_2
  1259.  
  1260. fb_y_more_routine:
  1261.         cmp     dh,cursor_y
  1262.         mov     quad,255
  1263.         ja      fbyl_less
  1264.         mov     quad,0
  1265.         jmp     fbym_1
  1266.  
  1267. fbyl_fix_quad_3_4:
  1268.         test    quad,255
  1269.         jz      fbylfq34_ret
  1270.         inc     ch
  1271.         inc     dh
  1272. fbylfq34_ret:
  1273.         ret
  1274.  
  1275. fb_v_line:
  1276.         push    dx
  1277.         push    cx
  1278.         mov     bh,screen_page
  1279.  
  1280.         mov     ch,cursor_y
  1281.         cmp     dh,ch
  1282.         jbe     fbvl_1
  1283.         xchg    dh,ch
  1284.  
  1285. fbvl_1: mov     ah,2            ;set curpos
  1286.         int     10h
  1287.         mov     ah,8
  1288.         int     10h             ;read c/a
  1289.  
  1290.         push    cx
  1291.         mov     bl,attrib
  1292.         mov     cx,1
  1293.         mov     ah,9
  1294.         int     10h             ;write new attrib
  1295.         pop     cx
  1296.  
  1297.         cmp     dh,ch
  1298.         je      fbvl_2
  1299.         inc     dh
  1300.         jmp     fbvl_1
  1301.  
  1302. fbvl_2: pop     cx
  1303.         pop     dx
  1304.         ret
  1305.  
  1306. fb_h_line:
  1307.         push    dx
  1308.         push    cx
  1309.         mov     bh,screen_page
  1310.  
  1311.         mov     cl,cursor_x
  1312.         cmp     dl,cl
  1313.         jbe     fbhl_1
  1314.         xchg    dl,cl
  1315.  
  1316. fbhl_1: mov     ah,2            ;set curpos
  1317.         int     10h
  1318.         mov     ah,8
  1319.         int     10h             ;read c/a
  1320.  
  1321.         push    cx
  1322.         mov     bl,attrib
  1323.         mov     cx,1
  1324.         mov     ah,9
  1325.         int     10h             ;write new attrib
  1326.         pop     cx
  1327.  
  1328.         cmp     dl,cl
  1329.         je      fbhl_2
  1330.         inc     dl
  1331.         jmp     fbhl_1
  1332.  
  1333. fbhl_2: pop     cx
  1334.         pop     dx
  1335.         ret
  1336.  
  1337. fb_center:
  1338.         push    dx
  1339.         mov     ah,3
  1340.         int     10h
  1341.         pop     cx
  1342.         push    dx
  1343.         mov     dx,cx
  1344.         mov     ah,2
  1345.         int     10h
  1346.         
  1347.         mov     ah,8
  1348.         int     10h
  1349.         push    cx
  1350.         mov     bl,7*16
  1351.         mov     cx,1
  1352.         mov     ah,9
  1353.         int     10h
  1354.         pop     cx
  1355.  
  1356.         pop     dx
  1357.         mov     ah,2
  1358.         int     10h
  1359.         mov     dx,cx
  1360.         ret
  1361.  
  1362.  
  1363. mu_putdown:
  1364.         call    save_screen     ;save for later undo
  1365.         mov     al,attrib
  1366.         push    ax
  1367.         mov     ins_del_flag,255
  1368.  
  1369.         mov     bh,screen_page
  1370.         mov     ah,3
  1371.         int     10h             ;get curpos
  1372.         push    dx              ;save it
  1373.  
  1374.         mov     ah,22
  1375.         xchg    ah,dh
  1376.         sub     dh,ah
  1377.         mov     al,79
  1378.         xchg    al,dl
  1379.         sub     dl,al
  1380.  
  1381.         mov     cx,paste_size
  1382.         cmp     dh,ch           ;take smaller of two
  1383.         jbe     mupd_1
  1384.         mov     dh,ch
  1385. mupd_1: cmp     dl,cl
  1386.         jbe     mupd_2
  1387.         mov     dl,cl
  1388.  
  1389. mupd_2: mov     si,offset paste_buffer
  1390.         mov     cl,dh           ;get # lines to do
  1391.         mov     ch,0            ;into CX
  1392.         mov     bl,dl           ;get # cols
  1393.         mov     bh,0            ;into BX
  1394.         pop     dx              ;get cursor pos
  1395.         push    dx
  1396.  
  1397. mupd_4: push    dx              ;save cursor pos
  1398.         push    cx              ;save # lines to do
  1399.         push    si              ;save current paste_buffer position
  1400.         mov     cx,bx           ;get # cols to do
  1401.  
  1402. mupd_3: push    cx              ;save # cols left
  1403.         push    bx              ;save total cols to do
  1404.         mov     bh,screen_page
  1405.  
  1406.         mov     ah,2            ;set curpos
  1407.         int     10h
  1408.  
  1409.         lodsw                   ;get c/a from p_buff
  1410.         mov     attrib,ah
  1411.         push    dx
  1412.         push    si
  1413.         call    alt_modes
  1414.         pop     si
  1415.         pop     dx
  1416.         mov     cx,1
  1417.         mov     ah,9
  1418.         int     10h             ;write c/a from buffer
  1419.  
  1420.         pop     bx
  1421.         pop     cx              ;get # chrs to do
  1422.         inc     dl              ;next csr col
  1423.         loop    mupd_3
  1424.         pop     si              ;restore start of line in paste buffer
  1425.         mov     cx,paste_size
  1426.         mov     ch,0
  1427.         add     cx,cx
  1428.         add     si,cx
  1429.         pop     cx              ;get # lines left to do
  1430.         pop     dx              ;restore cursor pos
  1431.         inc     dh
  1432.         loop    mupd_4
  1433.  
  1434.         pop     dx
  1435.         mov     bh,screen_page
  1436.         mov     ah,2
  1437.         int     10h             ;restore curpos
  1438.  
  1439.         pop     ax
  1440.         mov     attrib,al
  1441.         mov     ins_del_flag,0
  1442.         ret
  1443.  
  1444. Macro_mess_1 db esc,'[24;1f',esc,'I give up. If you want macros, use ProKey or something.$'
  1445.  
  1446.  
  1447. MU_ascii:
  1448.         call    save_cur
  1449.         call    save_screen
  1450.         mov     dx,offset ascii_table_data
  1451.         dos     9
  1452.         wait_for_key
  1453.         call    restore_screen
  1454.         call    restore_cur
  1455.         ret
  1456.  
  1457. MU_flip:
  1458.         call    cmd_f
  1459.         call    display_ctrls
  1460.         ret
  1461.  
  1462. cmd_f:
  1463.         mov     dx,offset screen_buffer_2
  1464.         mov     screen_no,2
  1465.         mov     filespec_ptr,offset filespec_buffer2
  1466.         cmp     screen_buffer, offset screen_buffer_1
  1467.         je      MUF_set
  1468.         mov     dx,offset screen_buffer_1
  1469.         mov     screen_no,1
  1470.         mov     filespec_ptr,offset filespec_buffer1
  1471. MUF_set:
  1472.         push    dx
  1473.         call    save_screen
  1474.         pop     dx
  1475.         mov     screen_buffer,dx
  1476.         call    restore_screen
  1477.         ret
  1478.  
  1479.  
  1480. wipe_prompt_1 db esc,'[24;1fAttributes, Text or Both (a/t/b)? $'
  1481. wipe_prompt_2 label byte
  1482. quit_prompt db esc,'[24;1fAre you sure (y/n)? $'
  1483. command_prompt db esc,'[24;1f',esc,'[0mCommand: $'
  1484. save_prompt db esc,'[24;1fSave to $'
  1485. CL_prompt db esc,'[24;1fLoad from $'
  1486. home db esc,'[1;1f$'
  1487. CL_err_mess db esc,'[24;1fError in Loading of file. Hit key to resume editing. (    )',esc,'[5D$'
  1488. CS_err_mess db esc,'[24;1fError: Couldn',27h,'t save file. Hit key to resume editing. (    )',esc,'[5D$'
  1489. crlf db 13,10
  1490. ctrl_z db 26
  1491.  
  1492.  
  1493. save_cur:
  1494.         mov     bh,screen_page
  1495.         mov     ah,3
  1496.         int     10h
  1497.         mov     cursor,dx
  1498.         ret
  1499.  
  1500. restore_cur:
  1501.         mov     bh,screen_page
  1502.         mov     ah,2
  1503.         mov     dx,cursor
  1504.         int     10h
  1505.         ret
  1506.  
  1507. no_bak_error db esc,'[24;1fError in renaming to .BAK; continue anyway (y/n)? $'
  1508.  
  1509. get_filespec:
  1510.         call    print_cs
  1511.         call    save_screen
  1512.         push    si
  1513.         mov     dx,filespec_ptr
  1514.         mov     si,dx
  1515.         mov     bl,[si+1]
  1516.         mov     bh,0
  1517.         mov     byte ptr [si+bx+2],13
  1518.         xchg    bx,si
  1519.         pop     si
  1520.         push    dx
  1521.         mov     ah,0Ah
  1522.         int     21h             ;input filename
  1523.         pop     bx
  1524.         add     bx,2
  1525.         mov     dx,bx
  1526.         mov     al,[bx-1]
  1527.         mov     ah,0
  1528.         or      ax,ax
  1529.         jz      GF_err
  1530.         add     bx,ax
  1531.         mov     byte ptr [bx],0
  1532.         push    bx
  1533.  
  1534. ;open file for r/w
  1535.         test    create,255
  1536.         jnz     GF_create
  1537.  
  1538.         mov     al,2
  1539.         push    dx
  1540.         mov     ah,3Dh
  1541.         int     21h
  1542.         pop     dx
  1543.         pop     bx
  1544.         jnc     get_fs_ret
  1545. GF_err: jmp     get_fs_ret_err
  1546. GF_create:
  1547.         mov     al,2
  1548.         push    dx
  1549.         mov     ah,3dh
  1550.         int     21h             ;open file for read/write
  1551.         pop     dx
  1552.         push    di
  1553.         jc      GFC_1           ;go create if not found
  1554.         push    dx              ;save $ addr
  1555.         mov     bx,ax           ;get handle
  1556.         dos     3Eh             ;close file
  1557.         pop     dx              ;get $ addr
  1558.  
  1559.  
  1560.         mov     bx,dx           ;get $ addr
  1561.         mov     di,offset buffer
  1562.  
  1563. GFC_2:  mov     al,[bx]         ;get char
  1564.         cmp     al,0            ;eos?
  1565.         jz      GF_bak
  1566.         cmp     al,'.'          ;start of .EXT?
  1567.         je      GF_bak
  1568.         inc     bx
  1569.         stosb                   ;save byte of $
  1570.         jmp     GFC_2
  1571.  
  1572. GF_bak: mov     al,'.'          ;ext marker
  1573.         stosb
  1574.         mov     al,'B'
  1575.         stosb
  1576.         mov     al,'A'
  1577.         stosb
  1578.         mov     al,'K'
  1579.         stosb   
  1580.         mov     al,0
  1581.         stosb
  1582.         mov     di,offset buffer     ;get ptr to .bak $
  1583.  
  1584.         push    dx              ;save $ addr
  1585.         mov     dx,di           ;get .bak filespec
  1586.         dos     41h             ;delete .bak
  1587.         pop     dx
  1588.  
  1589.         push    dx
  1590.         dos     56H             ;rename file to .BAK
  1591.         pop     dx
  1592.         jnc     GFC_1
  1593.         push    dx
  1594.         mov     dx,offset no_bak_error
  1595.         dos     9
  1596.         pop     dx
  1597. GFC_3:  wait_for_key
  1598.         call    capit_al
  1599.         cmp     al,'Y'
  1600.         je      GFC_1
  1601.         cmp     al,'N'
  1602.         jne     GFC_3
  1603.         pop     di
  1604.         pop     bx
  1605.         jmp short get_fs_ret_err
  1606.   
  1607. GFC_1:  pop     di              ;restore di
  1608.         mov     ah,3Ch
  1609.         mov     cx,0
  1610.         mov     al,2
  1611.         int     21h
  1612.         pop     bx
  1613.         jnc     get_fs_ret
  1614. get_fs_ret_err:
  1615.         stc
  1616.         jmp short gfr_1
  1617. get_fs_ret:
  1618.         call    move_filename   ;set filename to be printed on CTRL-line
  1619. gfr_1:  mov     byte ptr [bx],13     ;set buffer back to normal
  1620.         call    restore_screen
  1621.         ret
  1622.  
  1623. move_filename:
  1624.         pushf   
  1625.         push    ax
  1626.         push    bx
  1627.         push    cx
  1628.         push    dx
  1629.         push    si
  1630.         push    di
  1631.  
  1632.         mov     di,offset filename1
  1633.         cmp     screen_no,1
  1634.         je      mf_1
  1635.         mov     di,offset filename2
  1636. mf_1:   mov     bx,filespec_ptr
  1637.         add     bx,2
  1638.         cmp     byte ptr [bx+1],':'  ;device specified?
  1639.         mov     al,[bx]         ;get dev name
  1640.         je      mf_2 
  1641.         dos     19h             ;get current drive #
  1642.         add     al,65           ;make a letter of #
  1643. mf_2:   stosb                   ;put char in buffer
  1644.         mov     al,':'          ;with colon
  1645.         stosb
  1646.  
  1647.         dec     bx              ;bump to $ len
  1648.         mov     dx,bx           ;dx=start of $
  1649.         mov     al,[bx]         ;get input len
  1650.         inc     bx              ;move to $
  1651.         xor     ah,ah           ;ax=$ len
  1652.         add     bx,ax           ;bx=eo$
  1653.  
  1654. mf_loop1:
  1655.         dec     bx
  1656.         mov     al,[bx]         ;get char
  1657.         cmp     al,':'          ;start of filename?
  1658.         je      mf_sos
  1659.         cmp     al,'\'
  1660.         je      mf_sos
  1661.         dec     bx
  1662.         cmp     bx,dx           ;start of $?
  1663.         je      mf_sos
  1664.         inc     bx
  1665.         inc     cx
  1666.         jmp     mf_loop1
  1667.         
  1668. mf_sos: inc     cx
  1669.         inc     cx
  1670.         inc     bx
  1671.         loop    mf_loop2
  1672.         jmp     short mf_exit
  1673.  
  1674. mf_loop2:
  1675.         mov     al,[bx]
  1676.         stosb
  1677.         inc     bx
  1678.         loop    mf_loop2
  1679.  
  1680. mf_exit: 
  1681.         mov     al,0            ;terminate $
  1682.         stosb
  1683.  
  1684.         pop     di
  1685.         pop     si
  1686.         pop     dx
  1687.         pop     cx
  1688.         pop     bx
  1689.         pop     ax
  1690.         popf
  1691.  
  1692.         ret
  1693.  
  1694. adjust:
  1695.         mov     dl,max_col
  1696.         mov     dh,cur_line
  1697.         
  1698. adjust_loop:
  1699.         dec     dl
  1700.         cmp     dl,255
  1701.         jz      adjust_end
  1702.         mov     ah,2
  1703.         mov     bh,screen_page
  1704.         int     10h             ;set cur_pos
  1705.         mov     ah,8
  1706.         mov     bh,screen_page
  1707.         int     10h
  1708.         and     ah,16+32+64     ;background attrib active?
  1709.         jnz     adjust_end
  1710.         cmp     al,0            ;foreground nil?
  1711.         je      adjust_loopB
  1712.         cmp     al,255
  1713.         je      adjust_loopB
  1714.         cmp     al,32
  1715.         je      adjust_loopB
  1716. adjust_end:
  1717.         inc     dl
  1718.         mov     max_col,dl
  1719. A_ret:
  1720.         ret
  1721.  
  1722. adjust_loopB:
  1723.         and     ah,7*16         ;test for background color on.
  1724.         jz      adjust_loop
  1725.         jmp     adjust_end
  1726.   
  1727. write_spaces:
  1728.         cmp     space_count,6   ;more than 5 spaces queued?
  1729.         jc      WS_no           ;no
  1730.         push    ax
  1731.         push    dx
  1732.         mov     byte ptr [bp],esc
  1733.         inc     bp
  1734.         mov     byte ptr [bp],'['
  1735.         inc     bp
  1736.         mov     al,space_count
  1737.         mov     ah,0
  1738.         mov     dl,10
  1739.         div     dl
  1740.         or      al,al
  1741.         jz      WS_skip_1st
  1742.         add     al,48           ;make ASCII #
  1743.         mov     [bp],al
  1744.         inc     bp
  1745. WS_skip_1st:
  1746.         add     ah,48
  1747.         mov     byte ptr [bp],ah
  1748.         inc     bp
  1749.         mov     byte ptr [bp],'C'
  1750.         inc     bp
  1751.         mov     space_count,0
  1752.         pop     dx
  1753.         pop     ax
  1754.         ret
  1755. WS_no:  push    cx
  1756.         push    ax
  1757.         mov     al,32
  1758.         mov     cl,space_count
  1759.         xor     ch,ch
  1760.         jcxz    WS_1_ret
  1761. WS_1:   mov     [bp],al
  1762.         inc     bp
  1763.         loop    WS_1
  1764.         mov     space_count,0
  1765. WS_1_ret:
  1766.         pop     ax
  1767.         pop     cx
  1768. Another_return:
  1769.         ret
  1770.  
  1771. FA_1:   test    space_count,255 ;any spaces queued?
  1772.         jnz     FA_2
  1773.         test    ah,16+32+64     ;background 0? 
  1774.         jnz     FA_1b
  1775.  
  1776. FA_2:   push    ax
  1777.         mov     al,attrib
  1778.         and     al,240-128      ;mask all but background
  1779.         and     ah,240-128
  1780.         cmp     al,ah           ;are they the same
  1781.         pop     ax              ;restore c/a
  1782.         jne     FA_1_no_leave
  1783.         inc     space_count
  1784.         jmp     A_ret_2         ;return w/o writing
  1785. FA_1_no_leave:
  1786.         call    write_spaces
  1787.         test    ah,70h          ;background=0?
  1788.         mov     space_count,1
  1789.         jz      FA_1c
  1790.         mov     space_count,0
  1791.         jmp     FA_1b
  1792.  
  1793. A_ret_2:
  1794.         pop     bp
  1795.         jmp     A_ret_3
  1796.  
  1797. fix_attrib:
  1798.         mov     write,yes
  1799.         cmp     save_attribs,no ;return if not using ANSI chars
  1800.         je      another_return
  1801.  
  1802.         push    dx
  1803.         push    cx
  1804.         push    bx
  1805.         push    ax              ;save c/a
  1806.         mov     bp,offset buffer
  1807.         push    bp
  1808.  
  1809.         mov     write,no
  1810.         cmp     al,32           ;is char a space?
  1811.         je      FA_1            ;yes, go process
  1812.         test    space_count,255 ;are spaces queued?
  1813.         jz      FA_1b
  1814.         call    write_spaces
  1815.  
  1816. FA_1b:  mov     write,yes
  1817. FA_1c:  cmp     ah,attrib
  1818.         je      FA_save
  1819.         mov     byte ptr [bp],esc
  1820.         inc     bp
  1821.         mov     byte ptr [bp],'['
  1822.         inc     bp
  1823.  
  1824.         mov     attrib,ah
  1825.         mov     byte ptr [bp],'0'
  1826.         inc     bp
  1827.         mov     byte ptr [bp],';'
  1828.         inc     bp
  1829.         mov     byte ptr [bp],'3'
  1830.         inc     bp
  1831.         and     ah,7
  1832.         call    xlat_colors
  1833.         add     ah,30h          ;make decimal
  1834.         mov     byte ptr [bp],ah
  1835.         inc     bp
  1836.         mov     byte ptr [bp],';'
  1837.         inc     bp
  1838.         test    attrib,16+32+64 ;background set?
  1839.         jz      no_background
  1840.         mov     byte ptr [bp],'4'
  1841.         inc     bp
  1842.         mov     ah,attrib
  1843.         mov     cl,4
  1844.         ror     ah,cl
  1845.         and     ah,7
  1846.         call    xlat_colors
  1847.         add     ah,30h
  1848.         mov     byte ptr [bp],ah
  1849.         inc     bp
  1850.         mov     byte ptr [bp],';'
  1851.         inc     bp
  1852. no_background:
  1853.         test    attrib,8
  1854.         jz      no_intensity
  1855.         mov     byte ptr [bp],'1'
  1856.         inc     bp
  1857.         mov     byte ptr [bp],';'
  1858.         inc     bp
  1859. no_intensity:
  1860.         test    attrib,128
  1861.         jz      no_blinking
  1862.         mov     byte ptr [bp],'5'
  1863.         inc     bp
  1864.         inc     bp
  1865. no_blinking:
  1866.         dec     bp
  1867.         mov     byte ptr [bp],'m'
  1868.         inc     bp
  1869. FA_save:
  1870.         pop     cx
  1871.         push    cx              ;save pointer to buffer
  1872.         xchg    cx,bp
  1873.         sub     cx,bp
  1874.         pop     bp              ;restore ptr
  1875.         jcxz    A_ret_3
  1876.         mov     dx,offset buffer
  1877.         mov     ah,40h
  1878.         mov     bx,handle
  1879.         int     21h
  1880. A_ret_3:
  1881.         pop     ax
  1882.         pop     bx
  1883.         pop     cx
  1884.         pop     dx
  1885.         ret
  1886.  
  1887. colors db 0,4,2,6,1,5,3,7
  1888.  
  1889. Xlat_Colors:
  1890.         push    bx
  1891.         push    ax
  1892.         mov     al,ah
  1893.         mov     bx,offset colors
  1894.         xlat    colors
  1895.         pop     bx
  1896.         mov     ah,al
  1897.         mov     al,bl
  1898.         pop     bx
  1899.         ret
  1900.  
  1901. color_list db esc,'[24;1f'
  1902.         db esc,'[0;30;5;47mB',esc,'[0;30;47mlack'                  ;Black
  1903.         db esc,'[0;34;1;40m b',esc,'[0;34;1;5mL',esc,'[0;34;1mue ' ;bLue
  1904.         db esc,'[0;32;1;5;40mG',esc,'[0;32;1mreen '                ;Green
  1905.         db esc,'[0;36;1;5;40mC',esc,'[0;36;1myan '                 ;Cyan
  1906.         db esc,'[0;31;1;5;40mR',esc,'[0;31;1med '                  ;Red
  1907.         db esc,'[0;35;1;5;40mM',esc,'[0;35;1magenta '              ;Magenta
  1908.         db esc,'[0;33;1;5;40mY',esc,'[0;33;1mellow '               ;Yellow
  1909.         db esc,'[0;37;1;5;40mW',esc,'[0;37;1mhite '                ;White
  1910.         db '$'
  1911. colors_table db 9, 'BLGCRMYW',ESC
  1912. color_fore_back db esc,'[24;1fForeground or Background (f/b)? $'
  1913. color_blinking_mess db esc,'[24;1fBlinking (y/n)? $'
  1914. color_int_mess db esc,'[24;1fBright (y/n)? $'
  1915.  
  1916. save_prompt2 db esc,'[24;1fAnnex "Clear-Screen" to file (y/n)? ',esc,'[K$'
  1917. save_prompt3 db esc,'[24;1fSave with ANSI ESCape sequences (y/n)? ',esc,'[K$'
  1918. cls_file db esc,'[2J'
  1919. len_cls_file=4 
  1920.  
  1921. replace_mess1 db esc,'[24;1fReplace what char? $'
  1922. replace_mess2 db esc,'[24;1fReplace with what? $'
  1923. replace_mess3 db esc,'[24;1fReplace $'
  1924. replace_mess3b db esc,'[C with $'
  1925. replace_mess3c db esc,'[C (y/n)? $'
  1926.  
  1927. char_to_replace db ?
  1928. char_with_which_to_replace db ?
  1929.  
  1930. outchr: push    bx
  1931.         push    ax
  1932.         push    cx
  1933.         mov     bh,0
  1934.         mov     bl,attrib
  1935.         mov     cx,1
  1936.         mov     ah,9
  1937.         int     10h
  1938.         pop     cx
  1939.         pop     ax
  1940.         pop     bx
  1941.         ret
  1942.  
  1943. cmdr_esc:
  1944.         ret
  1945.  
  1946.  
  1947. cmd_R:
  1948.         mov     dx,offset replace_mess1
  1949.         dos     9
  1950.         
  1951. cr_1a:  wait_for_key            ;go get key from BIOS
  1952.     cmp    al,esc            ;esc from routine
  1953.         je      cmdr_esc
  1954.         cmp     al,32
  1955.         jc      cr_1a
  1956.         mov     char_to_replace,al
  1957.  
  1958.         mov     dx,offset replace_mess2
  1959.         dos     9
  1960. CR_1:   wait_for_key
  1961.         cmp     al,esc
  1962.         je      cmdr_esc
  1963.         cmp     al,32
  1964.         jc      CR_1
  1965.         mov     char_with_which_to_replace,al
  1966.  
  1967.         mov     dx,offset replace_mess3
  1968.         dos     9
  1969.         mov     al,char_to_replace
  1970.         call    outchr
  1971.         mov     dx,offset replace_mess3b
  1972.         dos     9
  1973.         mov     al,char_with_which_to_replace
  1974.         call    outchr
  1975.         mov     dx,offset replace_mess3c
  1976.         dos     9
  1977.  
  1978. CR_2:   wait_for_key
  1979.         call    capit_al
  1980.         cmp     al,'N'
  1981.         je      CR_exit
  1982.         cmp     al,'Y'
  1983.         jne     CR_2
  1984.         call    replacement_routine
  1985.  
  1986. cr_exit:
  1987.         ret
  1988.  
  1989. replacement_routine:
  1990.         mov     dx,0            ;screen pos
  1991. CR_3:   mov     bh,0
  1992.         mov     ah,2
  1993.         int     10h             ;set curpos
  1994.         
  1995.         mov     ah,8            ;read char
  1996.         int     10h
  1997.         cmp     al,char_to_replace
  1998.         jne     CR_4
  1999.         mov     al,char_with_which_to_replace
  2000.         mov     bl,ah
  2001.         mov     cx,1
  2002.         mov     ah,9
  2003.         int     10h             ;write replacement char
  2004.  
  2005. CR_4:   inc     dl              ;next column
  2006.         cmp     dl,79           ;last one?
  2007.         jne     CR_3            ;loop until done
  2008.         mov     dl,0
  2009.         inc     dh
  2010.         cmp     dh,22           ;last line?
  2011.         jne     cr_3
  2012.         
  2013.         ret
  2014.  
  2015.  
  2016. graphics_prompt db esc,'[24;1fReplace IBM graphic with others (y/n)? $'
  2017. CG_try2_mess db esc,'[24;1fReplace all ASCII codes >128 with spaces (y/n)? $'
  2018.  
  2019.  
  2020. cmd_g:
  2021.         mov     dx,offset graphics_prompt
  2022.         dos     9
  2023.  
  2024. cg_1:   wait_for_key
  2025.         call    capit_al
  2026.         cmp     al,esc
  2027.         je      cg_exit
  2028.         cmp     al,'N'
  2029.         je      cg_try2
  2030.         cmp     al,'Y'
  2031.         jne     cg_1
  2032.  
  2033.         mov     dx,0
  2034.         mov     bh,0
  2035. CG_2:   mov     ah,2
  2036.         int     10h
  2037.         mov     ah,8
  2038.         int     10h
  2039.         cmp     al,128
  2040.         jc      CG_3
  2041.         mov     bl,ah           ;xfer attrib
  2042.         push    bx
  2043.         mov     bx,offset ibm_list
  2044.         mov     ah,0
  2045.         sub     al,128
  2046.         add     bx,ax
  2047.         mov     al,[bx]         ;get replacement char
  2048.         pop     bx              
  2049.         mov     cx,1
  2050.         mov     ah,9
  2051.         int     10h             ;write new char out
  2052.  
  2053. CG_3:   inc     dl
  2054.         cmp     dl,79
  2055.         jne     CG_2
  2056.         mov     dl,0
  2057.         inc     dh
  2058.         cmp     dh,22
  2059.         jne     cg_2
  2060.         
  2061. CG_exit:
  2062.         ret
  2063. CG_try2:
  2064.         mov     dx,offset CG_try2_mess
  2065.         dos     9
  2066. CG_4:   getkey
  2067.         jz      CG_4
  2068.         call    capit_al
  2069.         cmp     al,'N'
  2070.         je      CG_exit
  2071.         cmp     al,esc
  2072.         je      CG_exit
  2073.         cmp     al,'Y'
  2074.         jne     CG_4
  2075.  
  2076.         mov     dx,0
  2077.         mov     bh,0
  2078. CG_5:   mov     ah,2
  2079.         int     10h
  2080.         mov     ah,8
  2081.         int     10h
  2082.         cmp     al,128
  2083.         jc      CG_6
  2084.         mov     bl,ah
  2085.         mov     al,32
  2086.         mov     cx,1
  2087.         mov     ah,9
  2088.         int     10h
  2089.  
  2090. CG_6:   inc     dl
  2091.         cmp     dl,79
  2092.         jne     CG_5
  2093.         mov     dl,0
  2094.         inc     dh
  2095.         cmp     dh,22
  2096.         jne     CG_5
  2097.         jmp     CG_exit
  2098.  
  2099. ibm_list db 'CueaaaaceeeiiiAAEaAooouuyOU$$$$$aiounN  ?[]  !""@@@'
  2100.          db '|++++++|+++++++++-++++++++-+++++++++++++'
  2101.          db '@@@@@', 255-224+1 dup(32)
  2102.  
  2103. cmd_U:
  2104.         call    restore_screen
  2105.         ret
  2106.  
  2107. cmd_C:
  2108.         mov     dx,offset color_fore_back
  2109.         call    print_cs
  2110. CC_1:   getkey
  2111.         jz      cc_1
  2112.         or      al,al
  2113.         jz      cc_1
  2114.         call    capit_al
  2115.         cmp     al,27
  2116.         je      cc_ret
  2117.         cmp     al,'F'
  2118.         mov     cl,0            ;rotate no bits.
  2119.         je      cc_get_color
  2120.         cmp     al,'B'
  2121.         mov     cl,4
  2122.         je      cc_get_color
  2123.         jmp     cc_1
  2124.  
  2125. cc_ret: ret
  2126.  
  2127. cc_get_color:
  2128.         mov     rotate,cl       ;save distance to rotate
  2129.         mov     dx,offset color_list
  2130.         call    print_cs
  2131. cc_2:   getkey
  2132.         jz      cc_2
  2133.         or      al,al
  2134.         jz      cc_2
  2135.         search  colors_table,ax
  2136.         JNE     CC_2
  2137.         CMP     AH,9
  2138.         JZ      CC_RET
  2139.         dec     ah              ;make a color
  2140.         mov     cl,rotate
  2141.         rol     ah,cl           ;set for attrib pos
  2142.         mov     al,attrib
  2143.         mov     dl,7            ;a mask
  2144.         rol     dl,cl           ;pos it
  2145.         or      al,dl
  2146.         xor     al,dl           ;remove unwanted bits
  2147.         or      al,ah           ;put in new bits
  2148.         mov     attrib,al
  2149.  
  2150.         or      cl,cl           ;doing foreground?
  2151.         jnz     cc_ret          ;no, skip other questions
  2152.  
  2153.         and     al,7+7*16       ;eliminate blink+intensity bits
  2154.         mov     attrib,al
  2155.  
  2156.         mov     dx,offset color_int_mess
  2157.         call    print_cs
  2158. cc_3:   getkey
  2159.         jz      cc_3
  2160.         or      al,al
  2161.         jz      cc_3
  2162.         call    capit_al
  2163.         cmp     al,esc
  2164.         jz      cc_ret
  2165.         cmp     al,'N'
  2166.         jz      cc_4
  2167.         cmp     al,'Y'
  2168.         jne     cc_3
  2169.         or      attrib,8
  2170. cc_4:   mov     dx,offset color_blinking_mess
  2171.         call    print_cs
  2172. cc_5:   getkey
  2173.         jz      cc_5
  2174.         or      al,al
  2175.         jz      cc_5
  2176.         call    capit_al
  2177.         cmp     al,esc
  2178.         jz      cc_ret2
  2179.         cmp     al,'N'
  2180.         jz      cc_ret2
  2181.         cmp     al,'Y'
  2182.         jne     cc_5
  2183.         or      attrib,128
  2184. cc_ret2:
  2185.         ret
  2186.  
  2187.  
  2188. CS_error:
  2189.         jmp     Save_error
  2190. cmd_S:
  2191.         mov     create,255
  2192.         mov     dx,offset save_prompt
  2193.         call    get_filespec
  2194.         jc      CS_error
  2195.         mov     handle,ax
  2196.         mov     attrib,7        ;set attrib to default
  2197.         mov     cur_line,21
  2198.  
  2199.         mov     dx,offset save_prompt2
  2200.         mov     ah,9
  2201.         int     21h
  2202. CS_p2:  wait_for_key            ;read char
  2203.         cmp     al,esc          ;don't save?
  2204.         je      CS_error
  2205.         call    capit_al
  2206.         cmp     al,'Y'          ;clear screen at start?
  2207.         jne     CS_p1
  2208.         mov     bx,handle
  2209.         mov     dx,offset cls_file
  2210.         mov     cx,len_cls_file
  2211.         dos     40h             ;write into file
  2212.         jmp     CS_a1           ;go on and check for saving attribs
  2213. CS_p1:  cmp     al,'N'
  2214.         jne     CS_p2
  2215.  
  2216. CS_a1:  mov     dx,offset save_prompt3
  2217.         dos     9
  2218. cs_a2:  wait_for_key
  2219.         cmp     al,esc
  2220.         je      CS_error
  2221.         call    capit_al
  2222.         cmp     al,'Y'
  2223.         jne     CS_a3
  2224.         mov     save_attribs,yes
  2225.         jmp     save_start
  2226. CS_a3:  cmp     al,'N'
  2227.         jne     cs_a2
  2228.         mov     save_attribs,no
  2229.  
  2230. save_start:
  2231.         cmp     cur_line,0FFh   ;-1? (past top of screen?)
  2232.         jnz     ss_1
  2233.         jmp     nothing_to_save
  2234. ss_1:   mov     max_col,79
  2235.         call    adjust
  2236.         dec     cur_line
  2237.         cmp     max_col,0
  2238.         jz      save_start
  2239.         mov     al,cur_line
  2240.         inc     al
  2241.         inc     al
  2242.         mov     max_line,al
  2243.         mov     cur_line,0
  2244. Save_loop:
  2245.         mov     max_col,79
  2246.         mov     cur_col,0
  2247.         call    adjust
  2248.         inc     max_col
  2249.         mov     cl,max_col
  2250.         mov     ch,0
  2251.         mov     space_count,0
  2252.         mov     write,yes
  2253.         push    cx
  2254. Save_line:
  2255.         pop     cx
  2256.         dec     cx
  2257.         jcxz    Save_line_done
  2258.         push    cx
  2259.         mov     dl,cur_col
  2260.         mov     dh,cur_line
  2261.         mov     bh,screen_page
  2262.         mov     ah,2
  2263.         int     10h
  2264.         mov     ah,8
  2265.         int     10h             ;get c/a from screen
  2266.         call    fix_attrib
  2267.         cmp     write,no        ;should we write this char?
  2268.         je      sl_1
  2269.         mov     byte ptr [buffer],al
  2270.         mov     cx,1
  2271.         mov     dx,offset buffer
  2272.         mov     ah,40h
  2273.         mov     bx,handle
  2274.         int     21h             ;write chr to file
  2275. SL_1:   inc     cur_col
  2276.         jmp     Save_line
  2277.  
  2278. Save_line_done:
  2279.         inc     cur_line
  2280.         mov     dx,offset crlf
  2281.         mov     cx,2
  2282.         mov     bx,handle
  2283.         mov     ah,40h
  2284.         int     21h
  2285.         mov     al,cur_line
  2286.         cmp     al,max_line
  2287.         jz      Save_done
  2288.         jmp     Save_loop
  2289.  
  2290. Save_done:
  2291. Nothing_to_save:
  2292.         mov     dx,offset ctrl_z
  2293.         mov     cx,1
  2294.         mov     ah,40h
  2295.         mov     bx,handle
  2296.         int     21h
  2297.         jc      Save_error
  2298.         or      ax,ax
  2299.         jz      Save_error
  2300.         call    CL_Ended
  2301.         ret
  2302.  
  2303. Save_error:
  2304.         push    ax              ;save error
  2305.         mov     dx,offset CS_err_mess
  2306.         call    print_cs
  2307.         pop     ax
  2308.         call    print_ax
  2309.         mov     ah,0Ch
  2310.         mov     al,1
  2311.         int     21h
  2312.         jmp     CL_ended
  2313.  
  2314. print_ax:
  2315.         push    ax
  2316.         push    cx
  2317.         push    dx
  2318.         push    ax
  2319.         mov     cl,4
  2320.         shr     ax,cl
  2321.         push    ax
  2322.         shr     ax,cl
  2323.         push    ax
  2324.         shr     ax,cl
  2325.         push    ax
  2326.  
  2327.         mov     cx,4
  2328. printax_1:
  2329.         pop     ax
  2330.         push    cx
  2331.         and     al,15
  2332.         add     al,48           ;make a number
  2333.         cmp     al,'9'          ;bigger than number
  2334.         jbe     printax_2
  2335.         add     al,7
  2336. printax_2:
  2337.         mov     dl,al
  2338.         dos     2               ;output char
  2339.         pop     cx
  2340.         loop    printax_1
  2341.         pop     dx
  2342.         pop     cx
  2343.         pop     ax
  2344.         ret
  2345.  
  2346. cmd_L:
  2347.         mov     create,0
  2348.         mov     dx,offset CL_prompt
  2349.         call    get_filespec
  2350.         jc      CL_error_2
  2351.         mov     handle,ax
  2352.         mov     dx,offset home
  2353.         call    print_cs
  2354. CL_loop:
  2355.         mov     bx,handle
  2356.         mov     ah,3Fh
  2357.         mov     cx,1
  2358.         mov     dx,offset buffer
  2359.         int     21h
  2360.         jc      CL_Error
  2361.         or      ax,ax
  2362.         jz      CL_Ended
  2363.  
  2364.         mov     dl,byte ptr [buffer]
  2365.         cmp     dl,26           ;^Z terminating?
  2366.         jz      CL_Ended
  2367.  
  2368.         mov     ah,2
  2369.         int     21h
  2370.         jmp     CL_loop
  2371.  
  2372. CL_Ended:
  2373.         push    ax
  2374.         mov     bx,handle
  2375.         cmp     bx,4 
  2376.         jbe     CLe_1           ;go if system handle
  2377.         mov     ah,3Eh
  2378.         int     21h             ;close file
  2379. CLe_1:  pop     ax
  2380.         ret
  2381.  
  2382. CL_Error:
  2383.         call    CL_ended        ;close file
  2384. CL_error_2:
  2385.         push    ax
  2386.         mov     dx,offset CL_err_mess
  2387.         call    print_cs
  2388.         pop     ax
  2389.         call    print_ax
  2390.         mov     ah,0Ch
  2391.         mov     al,1
  2392.         int     21h
  2393.         ret
  2394.  
  2395.  
  2396. cmd_Q:
  2397.         mov     dx,offset quit_prompt
  2398.         call    print_cs
  2399. quit_loop:
  2400.         getkey
  2401.         jz      quit_loop
  2402.         or      al,al
  2403.         jz      quit_loop       
  2404.         call    capit_al
  2405.         cmp     al,'N'
  2406.         je      quit_end
  2407.         cmp     al,esc
  2408.         je      quit_end
  2409.         cmp     al,'Y'
  2410.         jne     quit_loop
  2411.         pop     ax
  2412.         stc
  2413.         ret
  2414. quit_end:
  2415.         ret
  2416.  
  2417. cmd_M:
  2418.         ret
  2419. cmd_W:
  2420.         mov     dx,offset wipe_prompt_1
  2421.         call    print_cs
  2422. wl_1:   getkey
  2423.         jz      wl_1
  2424.         or      al,al
  2425.         jz      wl_1
  2426.         call    capit_al
  2427.         cmp     al,esc          ;ESC key hit?
  2428.         jz      wipe_end
  2429.         mov     dx,00FFh        ;attribs?
  2430.         mov     cx,0700h
  2431.         cmp     al,'A'
  2432.         jz      wl_2
  2433.         mov     dx,0FF00h       ;text
  2434.         mov     cx,0020h
  2435.         cmp     al,'T'
  2436.         jz      wl_2
  2437.         mov     dx,0000         ;both
  2438.         mov     cx,0720h
  2439.         cmp     al,'B'
  2440.         jnz     wl_1
  2441.  
  2442. wl_2:   push    dx
  2443.         push    cx
  2444.  
  2445.         mov     dx,offset wipe_prompt_2
  2446.         call    print_cs
  2447. wipe_loop:
  2448.         getkey
  2449.         jz      wipe_loop
  2450.         or      al,al
  2451.         jz      wipe_loop       
  2452.         call    capit_al
  2453.         cmp     al,'N'
  2454.         je      wipe_end
  2455.         cmp     al,esc
  2456.         je      wipe_end
  2457.         cmp     al,'Y'
  2458.         jne     wipe_loop
  2459.  
  2460.         pop     di
  2461.         pop     si
  2462.         mov     dx,0            ;new cursor pos
  2463.         mov     bh,screen_page
  2464.  
  2465. cls2:   mov     ah,2            ;set curpos
  2466.         int     10h
  2467.  
  2468.         mov     ah,8            ;read c/a
  2469.         int     10h
  2470.         and     ax,si           ;clear unwanted part
  2471.         or      ax,di           ;move in new replacement
  2472.         mov     bl,ah
  2473.         mov     cx,1
  2474.         mov     ah,9 
  2475.         int     10h             ;write new c/a
  2476.  
  2477.         inc     dl
  2478.         cmp     dl,79
  2479.         jne     cls2
  2480.         mov     dl,0
  2481.         inc     dh
  2482.         cmp     dh,22
  2483.         jne     cls2
  2484.  
  2485.         mov     cursor,0
  2486.         mov     attrib,7
  2487.  
  2488. wipe_end:
  2489.         ret
  2490.  
  2491. cmd_esc:
  2492.         clc
  2493.         pop     ax
  2494.         call    restore_cur
  2495.         ret
  2496.  
  2497. mode_cmd_status_line:
  2498.         call    display_ctrls
  2499.  
  2500. mode_cmd:
  2501.         mov     dx,offset command_prompt
  2502.         call    print_cs
  2503. MC_key_loop:
  2504.         getkey
  2505.         jz      MC_key_loop
  2506.         search  cmd_key,ax
  2507.         jne     MC_key_loop
  2508.         mov     cmd_cmd,ah
  2509.         jump    cmd_table,ah
  2510.         mov     ah,cmd_cmd    
  2511.         cmp     ah,4
  2512.         je      mode_cmd_status_line
  2513.         cmp     ah,5
  2514.         je      mode_cmd_status_line
  2515.         cmp     ah,6
  2516.         je      mode_cmd_status_line
  2517.         cmp     ah,9
  2518.         je      mode_cmd_status_line
  2519.         jmp     mode_cmd
  2520.  
  2521. status_line_1 db esc,'[23;1f',esc,'[0;40;33;7mtDoodle 1.20               '
  2522.         db 'Mode: $'
  2523. status_line_2 db 'Current Color$'
  2524. status_line_3 db esc,'[K',esc,'[0m',13,10,esc,'[K$'
  2525.  
  2526. status_line_4 db 'Paint  $'
  2527. status_line_5 db 'Text   $'
  2528. status_line_6 db 'Both   $'
  2529.  
  2530. status_line_10 db esc,'[0;40;33;7m   File-- $'
  2531.  
  2532. status_line_help db esc,'[25;1H'
  2533.         db esc,'[0;1m1',esc,'[0;7mBox   '
  2534.         db esc,'[0;1m 2',esc,'[0;7mGetClr'
  2535.         db esc,'[0;1m 3',esc,'[0;7mRevers'
  2536.         db esc,'[0;1m 4',esc,'[0;7mMode  '
  2537.         db esc,'[0;1m 5',esc,'[0;7mSayClr'
  2538.         db esc,'[0;1m 6',esc,'[0;7mFlip  '
  2539.         db esc,'[0;1m 7',esc,'[0;7mCut   '
  2540.         db esc,'[0;1m 8',esc,'[0;7mPaste '
  2541.         db esc,'[0;1m 9',esc,'[0;7mUndo  '
  2542.         db esc,'[0;1m 0',esc,'[0;7mASCII '
  2543.         db esc,'[0m$'
  2544.  
  2545. display_ctrls:
  2546.         push    bx
  2547.         push    cursor
  2548.         call    save_cur
  2549.         mov     dx,offset status_line_1
  2550.         call    print_cs
  2551.  
  2552.         mov     al,'S'
  2553.         call    alt_modes
  2554.         cmp     al,'S'
  2555.         jnz     DC_1
  2556.         mov     al,'T'
  2557. DC_1:   mov     dl,al
  2558.         mov     ah,02
  2559.         int     21h
  2560.         mov     dl,' '
  2561.         dos     2
  2562.  
  2563.         mov     ah,mode
  2564.         mov     cl,5
  2565.         ror     ah,cl
  2566.         mov     dx,offset status_line_6
  2567.         and     ah,3          
  2568.         jz      DC_2
  2569.         mov     dx,offset status_line_4
  2570.         dec     ah
  2571.         jz      DC_2
  2572.         mov     dx,offset status_line_5
  2573. DC_2:   call    print_cs
  2574.  
  2575.         mov     handle,0        ;con:
  2576.         mov     ah,attrib
  2577.         push    ax
  2578.         mov     ah,0            ;force attrib change
  2579.         call    fix_attrib
  2580.         pop     ax
  2581.         call    fix_attrib
  2582.  
  2583.         mov     dx,offset status_line_2
  2584.         call    print_cs
  2585.  
  2586.         mov     dx,offset status_line_10
  2587.         dos     9
  2588.         mov     bx,offset filename1  ;print filename
  2589.         cmp     screen_no,1
  2590.         je      DC_3
  2591.         mov     bx,offset filename2
  2592. DC_3:   mov     dl,[bx]         ;get file char
  2593.         or      dl,dl           ;eos?
  2594.         je      DC_4
  2595.         dos     2               ;output char
  2596.         inc     bx              ;bump to next char
  2597.         jmp     DC_3
  2598.  
  2599. dc_4:   mov     dx,offset status_line_3
  2600.         dos     9
  2601.  
  2602.         mov     dx,offset status_line_help
  2603.         mov     ah,9
  2604.         int     21h             ;print mess w/no crlf
  2605.  
  2606.         call    restore_cur
  2607.         pop     cursor
  2608.         pop     bx
  2609.         ret
  2610.  
  2611. ascii_table_data label byte
  2612. db esc,'[H'
  2613. db 27,91,48,59,51,50,109,201,205,205,205,205,205,205,205,205,205,205,205
  2614. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2615. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2616. db 205,205,205,205,205,205,205,187,13,10,186,32,27,91,48,59,51,54,59
  2617. db 49,109,49,50,56,32,128,32,32,49,52,52,32,144,32,32,49,54,48
  2618. db 32,160,32,32,49,55,54,32,176,32,32,49,57,50,32,192,32,32,50
  2619. db 48,56,32,208,32,32,50,50,52,32,224,32,32,50,52,48,32,240,32
  2620. db 27,91,48,59,51,50,109,186,13,10,186,32,27,91,48,59,51,51,109
  2621. db 49,50,57,32,129,32,32,49,52,53,32,145,32,32,49,54,49,32,161
  2622. db 32,32,49,55,55,32,177,32,32,49,57,51,32,193,32,32,50,48,57
  2623. db 32,209,32,32,50,50,53,32,225,32,32,50,52,49,32,241,32,27,91
  2624. db 48,59,51,50,109,186,13,10,186,32,27,91,48,59,51,54,59,49,109
  2625. db 49,51,48,32,130,32,32,49,52,54,32,146,32,32,49,54,50,32,162
  2626. db 32,32,49,55,56,32,178,32,32,49,57,52,32,194,32,32,50,49,48
  2627. db 32,210,32,32,50,50,54,32,226,32,32,50,52,50,32,242,32,27,91
  2628. db 48,59,51,50,109,186,13,10,186,32,27,91,48,59,51,51,109,49,51
  2629. db 49,32,131,32,32,49,52,55,32,147,32,32,49,54,51,32,163,32,32
  2630. db 49,55,57,32,179,32,32,49,57,53,32,195,32,32,50,49,49,32,211
  2631. db 32,32,50,50,55,32,227,32,32,50,52,51,32,243,32,27,91,48,59
  2632. db 51,50,109,186,13,10,186,32,27,91,48,59,51,54,59,49,109,49,51
  2633. db 50,32,132,32,32,49,52,56,32,148,32,32,49,54,52,32,164,32,32
  2634. db 49,56,48,32,180,32,32,49,57,54,32,196,32,32,50,49,50,32,212
  2635. db 32,32,50,50,56,32,228,32,32,50,52,52,32,244,32,27,91,48,59
  2636. db 51,50,109,186,13,10,186,32,27,91,48,59,51,51,109,49,51,51,32
  2637. db 133,32,32,49,52,57,32,149,32,32,49,54,53,32,165,32,32,49,56
  2638. db 49,32,181,32,32,49,57,55,32,197,32,32,50,49,51,32,213,32,32
  2639. db 50,50,57,32,229,32,32,50,52,53,32,245,32,27,91,48,59,51,50
  2640. db 109,186,13,10,186,32,27,91,48,59,51,54,59,49,109,49,51,52,32
  2641. db 134,32,32,49,53,48,32,150,32,32,49,54,54,32,166,32,32,49,56
  2642. db 50,32,182,32,32,49,57,56,32,198,32,32,50,49,52,32,214,32,32
  2643. db 50,51,48,32,230,32,32,50,52,54,32,246,32,27,91,48,59,51,50
  2644. db 109,186,13,10,186,32,27,91,48,59,51,51,109,49,51,53,32,135,32
  2645. db 32,49,53,49,32,151,32,32,49,54,55,32,167,32,32,49,56,51,32
  2646. db 183,32,32,49,57,57,32,199,32,32,50,49,53,32,215,32,32,50,51
  2647. db 49,32,231,32,32,50,52,55,32,247,32,27,91,48,59,51,50,109,186
  2648. db 13,10,186,32,27,91,48,59,51,54,59,49,109,49,51,54,32,136,32
  2649. db 32,49,53,50,32,152,32,32,49,54,56,32,168,32,32,49,56,52,32
  2650. db 184,32,32,50,48,48,32,200,32,32,50,49,54,32,216,32,32,50,51
  2651. db 50,32,232,32,32,50,52,56,32,248,32,27,91,48,59,51,50,109,186
  2652. db 13,10,186,32,27,91,48,59,51,51,109,49,51,55,32,137,32,32,49
  2653. db 53,51,32,153,32,32,49,54,57,32,169,32,32,49,56,53,32,185,32
  2654. db 32,50,48,49,32,201,32,32,50,49,55,32,217,32,32,50,51,51,32
  2655. db 233,32,32,50,52,57,32,249,32,27,91,48,59,51,50,109,186,13,10
  2656. db 186,32,27,91,48,59,51,54,59,49,109,49,51,56,32,138,32,32,49
  2657. db 53,52,32,154,32,32,49,55,48,32,170,32,32,49,56,54,32,186,32
  2658. db 32,50,48,50,32,202,32,32,50,49,56,32,218,32,32,50,51,52,32
  2659. db 234,32,32,50,53,48,32,250,32,27,91,48,59,51,50,109,186,13,10
  2660. db 186,32,27,91,48,59,51,51,109,49,51,57,32,139,32,32,49,53,53
  2661. db 32,155,32,32,49,55,49,32,171,32,32,49,56,55,32,187,32,32,50
  2662. db 48,51,32,203,32,32,50,49,57,32,219,32,32,50,51,53,32,235,32
  2663. db 32,50,53,49,32,251,32,27,91,48,59,51,50,109,186,13,10,186,32
  2664. db 27,91,48,59,51,54,59,49,109,49,52,48,32,140,32,32,49,53,54
  2665. db 32,156,32,32,49,55,50,32,172,32,32,49,56,56,32,188,32,32,50
  2666. db 48,52,32,204,32,32,50,50,48,32,220,32,32,50,51,54,32,236,32
  2667. db 32,50,53,50,32,252,32,27,91,48,59,51,50,109,186,13,10,186,32
  2668. db 27,91,48,59,51,51,109,49,52,49,32,141,32,32,49,53,55,32,157
  2669. db 32,32,49,55,51,32,173,32,32,49,56,57,32,189,32,32,50,48,53
  2670. db 32,205,32,32,50,50,49,32,221,32,32,50,51,55,32,237,32,32,50
  2671. db 53,51,32,253,32,27,91,48,59,51,50,109,186,13,10,186,32,27,91
  2672. db 48,59,51,54,59,49,109,49,52,50,32,142,32,32,49,53,56,32,158
  2673. db 32,32,49,55,52,32,174,32,32,49,57,48,32,190,32,32,50,48,54
  2674. db 32,206,32,32,50,50,50,32,222,32,32,50,51,56,32,238,32,32,50
  2675. db 53,52,32,254,32,27,91,48,59,51,50,109,186,13,10,186,32,27,91
  2676. db 48,59,51,51,109,49,52,51,32,143,32,32,49,53,57,32,159,32,32
  2677. db 49,55,53,32,175,32,32,49,57,49,32,191,32,32,50,48,55,32,207
  2678. db 32,32,50,50,51,32,223,32,32,50,51,57,32,239,32,32,50,53,53
  2679. db 32,255,32,27,91,48,59,51,50,109,186,13,10,200,205,205,205,205,205
  2680. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2681. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2682. db 205,205,205,205,205,205,205,205,205,205,205,205,205,188,13,10
  2683. db 36
  2684.  
  2685.  
  2686.  
  2687. screen_buffer_1 label word
  2688.  
  2689. db 27,91,50,74,27,91,48,59,51,55,59,49,109,213,205,205,205,205,205
  2690. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2691. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2692. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2693. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,184,13,10,179
  2694. db 27,91,56,67,27,91,48,59,51,54,109,219,223,223,223,223,220,220,27
  2695. db 91,50,53,67,223,219,27,91,49,53,67,220,219,32,32,32,32,220,223
  2696. db 223,223,223,220,32,220,223,223,223,223,220,32,27,91,48,59,51,55,59
  2697. db 49,109,179,13,10,179,32,32,32,27,91,48,59,51,54,109,219,32,32
  2698. db 32,32,219,27,91,54,67,223,220,27,91,50,49,67,219,32,32,219,27
  2699. db 91,49,54,67,219,27,91,57,67,219,32,219,32,32,32,32,219,32,27
  2700. db 91,48,59,51,55,59,49,109,179,13,10,179,32,27,91,48,59,51,54
  2701. db 109,220,220,219,220,220,32,32,219,32,32,74,97,110,32,32,219,32,32
  2702. db 220,220,220,220,32,32,32,220,220,220,220,32,32,32,220,220,220,220,32
  2703. db 219,32,32,219,32,32,32,220,220,220,220,27,91,57,67,219,27,91,57
  2704. db 67,219,32,219,32,32,32,32,219,32,27,91,48,59,51,55,59,49,109
  2705. db 179,13,10,179,32,32,32,27,91,48,59,51,54,109,219,32,32,32,32
  2706. db 219,32,32,32,50,48,32,32,219,32,219,32,32,32,32,219,32,219,32
  2707. db 32,32,32,219,32,219,32,32,32,32,223,219,32,32,219,32,32,219,32
  2708. db 32,32,32,219,27,91,56,67,219,32,32,32,32,220,223,223,223,223,32
  2709. db 32,219,32,32,32,32,219,32,27,91,48,59,51,55,59,49,109,179,13
  2710. db 10,179,32,32,32,27,91,48,59,51,53,109,219,32,32,32,32,219,32
  2711. db 49,57,56,54,32,32,219,32,219,32,32,32,32,219,32,219,32,32,32
  2712. db 32,219,32,219,32,32,32,32,32,219,32,32,219,32,32,219,223,223,223
  2713. db 223,223,27,91,56,67,219,32,32,32,32,219,27,91,54,67,219,32,32
  2714. db 32,32,219,32,27,91,48,59,51,55,59,49,109,179,13,10,179,32,32
  2715. db 32,27,91,48,59,51,49,109,219,32,32,220,32,219,32,32,32,32,220
  2716. db 220,223,32,32,219,32,32,32,32,219,32,219,32,32,32,32,219,32,219
  2717. db 32,32,32,32,220,219,32,32,219,32,32,219,32,32,32,32,220,27,91
  2718. db 56,67,219,32,32,32,32,219,27,91,54,67,219,32,32,32,32,219,32
  2719. db 27,91,48,59,51,55,59,49,109,179,13,10,179,32,32,32,32,27,91
  2720. db 48,59,51,52,109,223,223,32,32,223,223,223,223,223,27,91,54,67,223
  2721. db 223,223,223,32,32,32,223,223,223,223,32,32,32,223,223,223,223,32,223
  2722. db 32,223,223,223,32,32,223,223,223,223,27,91,56,67,223,223,223,32,223
  2723. db 32,223,223,223,223,223,223,32,32,223,223,223,223,32,32,27,91,48,59
  2724. db 51,55,59,49,109,179,13,10,198,205,205,205,205,205,205,205,205,205,205
  2725. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2726. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2727. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2728. db 205,205,205,205,205,205,205,205,205,205,181,13,10,179,27,91,50,52,67
  2729. db 27,91,48,59,51,51,109,84,69,88,84,32,83,67,82,69,69,78,32
  2730. db 68,79,79,68,76,73,78,71,32,66,79,65,82,68,27,91,50,55,67
  2731. db 27,91,48,59,51,55,59,49,109,179,13,10,179,27,91,49,55,67,27
  2732. db 91,48,59,51,51,109,119,114,105,116,116,101,110,32,97,110,100,32,100
  2733. db 101,115,105,103,110,101,100,32,98,121,32,27,91,48,59,51,50,109,68
  2734. db 97,110,105,101,108,32,69,46,32,66,101,110,110,101,116,116,27,91,49
  2735. db 57,67,27,91,48,59,51,55,59,49,109,179,13,10,179,27,91,51,48
  2736. db 67,27,91,48,59,51,50,109,80,46,79,46,66,111,120,32,55,56,50
  2737. db 48,27,91,51,53,67,27,91,48,59,51,55,59,49,109,179,13,10,179
  2738. db 27,91,50,55,67,27,91,48,59,51,50,109,76,97,32,86,101,114,110
  2739. db 101,44,32,67,65,32,57,49,55,53,48,27,91,51,50,67,27,91,48
  2740. db 59,51,55,59,49,109,179,13,10,179,27,91,55,55,67,179,13,10,179
  2741. db 27,91,54,67,27,91,48,59,51,51,109,80,108,101,97,115,101,32,103
  2742. db 105,118,101,32,97,32,99,111,112,121,32,116,111,32,97,110,121,111,110
  2743. db 101,32,119,104,111,32,119,97,110,116,115,32,111,110,101,46,32,73,102
  2744. db 32,121,111,117,32,102,105,110,100,32,105,116,32,117,115,101,102,117,108
  2745. db 44,32,32,32,32,32,27,91,48,59,51,55,59,49,109,179,13,10,179
  2746. db 32,27,91,48,59,51,51,109,97,32,36,49,50,167,167,32,114,101,103
  2747. db 105,115,116,114,97,116,105,111,110,32,102,101,101,32,119,111,117,108,100
  2748. db 32,98,101,32,103,114,101,97,116,108,121,32,97,112,112,114,101,99,105
  2749. db 97,116,101,100,46,32,73,116,32,119,105,108,108,32,97,108,115,111,32
  2750. db 103,101,116,32,121,111,117,32,27,91,48,59,51,55,59,49,109,179,13
  2751. db 10,179,27,91,49,50,67,27,91,48,59,51,51,109,105,110,102,111,114
  2752. db 109,97,116,105,111,110,32,111,110,32,102,117,116,117,114,101,32,117,112
  2753. db 100,97,116,101,115,44,32,102,105,120,101,115,44,32,97,110,100,32,97
  2754. db 100,100,105,116,105,111,110,115,46,27,91,49,51,67,27,91,48,59,51
  2755. db 55,59,49,109,179,13,10,179,32,32,32,32,32,27,91,48,59,51,50
  2756. db 109,89,111,117,32,99,97,110,32,103,101,116,32,116,104,101,32,108,97
  2757. db 116,101,115,116,32,118,101,114,115,105,111,110,32,111,102,32,116,68,111
  2758. db 111,100,108,101,32,102,114,111,109,32,76,97,32,86,101,114,110,101,32
  2759. db 38,32,80,67,32,83,116,114,101,101,116,32,32,32,32,32,27,91,48
  2760. db 59,51,55,59,49,109,179,13,10,179,27,91,49,53,67,27,91,48,59
  2761. db 51,50,109,66,66,83,46,32,32,67,97,108,108,32,50,52,32,72,111
  2762. db 117,114,115,32,97,116,32,56,44,110,44,49,46,32,32,27,91,48,59
  2763. db 51,50,59,49,109,55,49,52,45,53,57,54,45,48,48,56,52,27,91
  2764. db 49,57,67,27,91,48,59,51,55,59,49,109,179,13,10,179,32,32,32
  2765. db 32,32,27,91,48,59,51,51,109,70,111,114,32,105,110,115,116,114,117
  2766. db 99,116,105,111,110,115,32,111,110,32,117,115,101,44,32,112,108,101,97
  2767. db 115,101,32,101,120,105,116,32,40,27,91,48,59,51,52,59,49,109,69
  2768. db 83,67,32,81,32,89,27,91,48,59,51,51,109,41,32,97,110,100,32
  2769. db 114,101,97,100,32,27,91,48,59,51,52,59,49,109,116,68,111,111,100
  2770. db 108,101,46,84,120,116,32,32,32,32,32,27,91,48,59,51,55,59,49
  2771. db 109,179,13,10,212,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2772. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2773. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2774. db 205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205
  2775. db 205,205,205,205,205,205,190,13,10,27,91,50,52,67,27,91,48,59,51
  2776. db 49,59,49,59,53,109,83,116,114,105,107,101,32,97,110,121,32,107,101
  2777. db 121,32,116,111,32,99,111,110,116,105,110,117,101,46,46,46,13,10
  2778.  
  2779.         org     $+1760*2+2
  2780. screen_buffer_2 label word
  2781.         org     $+1760*2+2
  2782. paste_buffer label byte
  2783.         org     $+1760*2+2
  2784. end_of_code label byte
  2785.  
  2786. cseg    ends
  2787.         end     start
  2788.